Jump to content
The Uniform Server Community

MultipleVirtual hosts? How to setup


twpmarket
 Share

Recommended Posts

I want to create two (or more) virtual hosts on my local Uniform Server installation. I've read through the forum postings and see some discussion of doing this, but no enough to match my situation.

 

I have multiple development websites being tested on the Uniform Server platform before uploading to a server on the 'net.

 

I can get one or the other to be displayed, but only by reversing their sequence in the http_conf file. I read in the Apache docs that this is probably because the first Vhost on the list is considered the main server and will be delivered to the browser if the other Vhost servers have an "unknown name".

 

The Apache docs have little to say about configuring using localhost, except this:

 

"Requests for any address not specified in one of the <VirtualHost> directives (such as localhost, for example) will go to the main server, if there is one."

 

 

Will someone explain to me where my configuration (below) is failing? Is localhost only able to handle only one virtual host name, or did I code it incorrectly?

 

Listen is set to port 80

Userdir is /www/

I used the VHost script in the Uniform Server to create these vir. hosts.

Each folder in DocumentRoot has a complete and functional set of files in its respective directories, they both work.

 

This is the code from my http_conf file:

 

##########VIRTUAL HOST SETUP##########

# STOPBRITE.LOCALHOST

<VirtualHost *>

ServerName stopbrite.localhost

DocumentRoot /www/stopbrite

</VirtualHost>

##########VIRTUAL HOST SETUP##########

# TWPMARKET.LOCALHOST

<VirtualHost *>

ServerName twpmarket.localhost

DocumentRoot /www/twpmarket

</VirtualHost>

Link to comment
Share on other sites

Ok, after too many sleepless hours, this is what I did and it works for my usage:

 

I set up one Virtual Host in http_conf:

 

##########VIRTUAL HOST SETUP##########

# LOCALHOST

<VirtualHost *>

ServerName localhost

DocumentRoot /www/

</VirtualHost>

 

In the "www" root folder, I have sub-folders for each of my sites, containing the full site code, as if the sub-folder were the root.

 

In the "www" root folder, I placed a single page, "index.php" and it contains simple html links to as many other sub-folders as I want. For example:

 

<a href="http://localhost/twpmarket">TWP Marketing</a>

<a href="http://localhost/stopbrite">Stop*Brite</a>

 

Since I use Dreamweaver to upload my files to the host, I've configured DW for each site to point to the sub-folder on LocalHost, ie:

 

Remote Folder: w:\www\twpmarke\

http address: http://localhost:80/www/stopbrite/

 

Remote Folder: w:\www\stopbrite\

http address: http://localhost:80/www/twpmarket/

 

This works for me and I hope others may be able to use this method. Please let me know if anybody is aware of potential problems from this configuration. Thanks!

Link to comment
Share on other sites

Check to see that this is not commented:

 

NameVirtualHost *

 

And then put those 2 on top and make sure the localhost VirtualHost info is before them...

 

Something like this:

 

NameVirtualHost *

##########VIRTUAL HOST SETUP##########
# LOCALHOST
<VirtualHost *>
ServerName localhost
DocumentRoot /www/
</VirtualHost>
##########VIRTUAL HOST SETUP##########
# STOPBRITE.LOCALHOST
<VirtualHost *>
ServerName stopbrite.localhost
DocumentRoot /www/stopbrite
</VirtualHost>
##########VIRTUAL HOST SETUP##########
# TWPMARKET.LOCALHOST
<VirtualHost *>
ServerName twpmarket.localhost
DocumentRoot /www/twpmarket
</VirtualHost>

 

If that does not work, messa round with it a little, like removing the localhost one and testing it to see if it will work... and so on.. you know... help me out a little and you all stop being lazy to go crazy with the thing... :lol:

 

Next time i might be on here might be next week cause i am moving.. no internet.. :D

Link to comment
Share on other sites

It was the NameVirtualHost * which WAS commented out.

Uncommented theline and then I used your example, and it works perfectly. Thank you!

 

Check to see that this is not commented:

 

NameVirtualHost *

 

And then put those 2 on top and make sure the localhost VirtualHost info is before them...

 

Something like this:

 

NameVirtualHost *

##########VIRTUAL HOST SETUP##########
# LOCALHOST
<VirtualHost *>
ServerName localhost
DocumentRoot /www/
</VirtualHost>
##########VIRTUAL HOST SETUP##########
# STOPBRITE.LOCALHOST
<VirtualHost *>
ServerName stopbrite.localhost
DocumentRoot /www/stopbrite
</VirtualHost>
##########VIRTUAL HOST SETUP##########
# TWPMARKET.LOCALHOST
<VirtualHost *>
ServerName twpmarket.localhost
DocumentRoot /www/twpmarket
</VirtualHost>

 

If that does not work, messa round with it a little, like removing the localhost one and testing it to see if it will work... and so on.. you know... help me out a little and you all stop being lazy to go crazy with the thing... :lol:

 

Next time i might be on here might be next week cause i am moving.. no internet.. :D

2207[/snapback]

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.

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...
 Share

×
×
  • Create New...