Jump to content
The Uniform Server Community

Virtual host - only one recognised


Joosttt
 Share

Recommended Posts

Hi,

 

I just started with Uniform Server and I just love the portability. There is just one little thing I can't get to work. And that is the Virtual host.

 

I used virtual host before on linux so i figured this would be a breeze. But somehow apache only uses the first virtual host entry. To make is easy i'm using 'test' as alias. So my hosts file in c:\windows\system32\driver\etc contains the following line:

 

127.0.0.1 test

 

on the bottom of my httpd.conf file there is the following:

 

<VirtualHost *>

DocumentRoot /www/test

ServerName test

</VirtualHost>

 

I tryed restarting windows and using fresh installations, but when I paste this peace of code in my httpd.conf file apache directs everything to the test map. So both http://localhost and http://test gets me to /www/test . When i'm using more virtual hosts only the first is used.

 

I'm stuck here and it would be great if anyone could point me in de right direction here.

Link to comment
Share on other sites

Your set-up is working correctly.

 

The address you have supplied http://localhost is not recognised by Apache so cannot be found hence uses the default which is always the first VirtualHost.

 

This page explains it in more detail:

 

http://center.uniformserver.com/virtual_ho...ual_host_1.html

 

All the best :rolleyes:

Link to comment
Share on other sites

But when I add the following to my httpd.conf file:

 

<VirtualHost *>

DocumentRoot /www/test

ServerName test

</VirtualHost>

 

<VirtualHost *>

DocumentRoot /www/test2

ServerName test2

</VirtualHost>

 

It always goes to the 'test' map. So both http://test and http://test2 point to the /www/test directory. The /www/test2 map does exists and has a very simple index.html file in it.

 

It's like it always uses the default. What am I doing wrong?

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