-   Fedora (
-   -   virtual hosts problem - fedora core 4 (

john_f 04-03-2006 05:04 AM

virtual hosts problem - fedora core 4

i want to setup some virtual hosts on fedora (core 4), when i add the first host in httpd.conf localhost will go in the directory of my first virtual host (site1), same as the second host (site2)

what's the problem in the following lines

<VirtualHost *:80>
DocumentRoot var/www/html/site1
ServerName wwwsite1com (i cannot post links (:)

<VirtualHost *:80>
DocumentRoot var/www/html/site2
ServerName wwwsite2com (same here (:)

i already setup site1 and 2 in /etc/hosts

Thank you.

WhatsHisName 04-04-2006 01:28 AM

Didn’t understand the question, but I think you are probably puzzled by why all calls for localhost only load the first virtual host.

The first virtual host is the default for any requests that do not match subsequent virtual hosts’ ServerName or ServerAlias. Although most people usually define the ServerName for the first virtual host, you really don’t even need a ServerName for the first virtual host.

Since “localhost” does not match the second virtual host ServerName, then the default when you call for localhost is to load the first virtual host. You can use a ServerAlias alone or in combination with different ports to locally distinguish between the two sites.

For example, ServerAlias for the second virtual host could be defined as the LAN ip address of the system. Any local call to the LAN ip address would select the second virtual host, whereas localhost would default to the first virtual host.

Also, you should use a DirectoryIndex for each virtual host.

All times are GMT -5. The time now is 11:00 PM.