I am setting up VHOSTS on my home server in a way which seems to match the way it is set up on the server I user for work but the behavior is not correct.
The server IP address is 192.168.1.100
I have created 4 virtual hosts, and created their directories under /var/www/vhosts/vh01 through vh04
each one of those directories with a /html and a /log subdirectory.
I have created a series of files called ifcfg-eth0:x where x is from 1 to 4 and placed them in /etc/sysconfig/network-scr
ipts/
each one of them contains the following lines (sample for the :1 guy, the other three have the proper modifications:
DEVICE=eth0:1
ONBOOT=yes
IPADDR=192.168.1.101
NETMASK=255.255.255.0
I created 4 files which I placed in /etc/httpd/conf/vhosts/ with the filenames:
192-168-1-10x.conf where x is 1 through 4 and which contain: (the appropriate changes made for each one)
<VirtualHost 192.168.1.101:80>
ServerAdmin jonvaljean@gmail.com
DocumentRoot /var/www/vhosts/vh01/html
ServerName
www.gorbeauhome.comErrorLog /var/www/vhosts/vh01/log/e
rror_log
TransferLog /var/www/vhosts/vh01/log/a
ccess_log
</VirtualHost>
I added the following line to /etc/httpd/conf/httpd.conf
Include conf/vhosts/*.conf
as well as the line
DirectoryIndex index.html index.html.var index.htm
In each of the /vh0x/html/ directories I placed a different index.html which clearly indicates from which virtual host it is being served
I think I did everytning correctly.
THE PROBLEM:
If i browse to 192.168.1.100 (which is the address of the machine) the index page is served which is in the document root which is listed in httpd.conf
DocumentRoot "/var/www/html"
if i browse to 192.168.1.101 or 102 or 103 or 104, I get served THE SAME PAGE
but if I browse to
192.168.1.101/index.htm I GET THE CORRECT PAGE FROM THE vh01 virtual host, or likewise the others.
So for some reason the Document Root of the base host is always taking precedence when I browse to a directory.
That is not the behavior of the machine I use at work, so I am baffled.
Can you help?
Thanks very much.
Jon
Etretat
Normandy
France
Start Free Trial