Jump to content

Virtual Host Dilema


Recommended Posts

Hi- I'm very new to php and mysql...I kinda like it lol. I'm working with a tutorial and have mamp set up and working well. Then I added another site into the htdocs folder and discovered I need to configure the server to work with more than one site.

 

Here's the problem. I access the host file via terminal on a mac and my have fowled up the file.

 

 

 

 

I followed the steps at this link which look semi clear:

 

http://www.sawmac.com/mamp/virtualhosts/index.php

 

My host file says command not found. Note- I accessed the backup file by typing this into terminal:

 

sudo cp /etc/hosts /etc/hosts.bak and think I made a mess out of it.

 

How do I set up a virtual host (more than 1 site on the mamp server)?

Is my host file ok?

How do I access the new site after the first one?

What exactly is the host file?

Is virtual just a fancy way of saying multiple sites on one server?

 

Thanks!

Link to comment
Share on other sites

discovered I need to configure the server to work with more than one site.

I'm slightly confused... can't you just put multiple folders within the htdocs folder? That's what I have always done...? You could then access the site using

 

http://localhost:8888/your_site_folder_1

http://localhost:8888/your_site_folder_2

 

(or whatever your localhost URL is)

 

Is virtual just a fancy way of saying multiple sites on one server?

I believe so.

Link to comment
Share on other sites

I'm sure you know more than I do; I get this message when I set the second site up:

 

The site URL prefix [] for the testing server does not match the site URL prefix []specified in HTTP Address for the site

 

The first site works just fine but the second site doesn't show in the browser. I'm entering http://localhost/mysiteA and http://localhost/mysiteB'>http://localhost/mysiteB

 

http://localhost/mysiteB doesn't show. The browser fails to load the page and I get this message:

 

Can't connect to MySQL server on 'tuviano.db.6217275.hostedresource.com' (4)

 

If there's no need to do anything differently what's a virtual server?

 

Thanks!

 

 

I'm slightly confused... can't you just put multiple folders within the htdocs folder? That's what I have always done...? You could then access the site using

 

http://localhost:8888/your_site_folder_1

http://localhost:8888/your_site_folder_2

 

(or whatever your localhost URL is)

 

 

I believe so.

Link to comment
Share on other sites

You're right. I figured it out. I was given an ip address and changed the http://localhost/siteA to http://siteA and it worked. Why is this? Is it because I'm accessing a remote server vs using mamp?

 

Thanks

 

 

 

Sounds like you do not have the second site's config file to point to a active database. Either the config file is incorrect or you don't have a database assigned for the second site.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...