Apache 2 httpd virtual hosts not working
Hi,
I am running CentOS 5.4 and Apache 2.2.3 straight out of the box. Problem is vhosts will not work. All I can get is a test page or the manual. The machine I am accessing from has the hosts file edited to point test.loc to 192.168.1.254 on my LAN. Owner:group are apache:apache, same as the server is running and permissions include read by owner. No errors in the logs. Any suggestions? httpd.conf <VirtualHost _default_:*> DocumentRoot /var/www/apache/manual # DocumentRoot /var/www/eswebs </VirtualHost> NameVirtualHost *:80 <VirtualHost *:80> ServerName test.loc ServerAlias test.com www.test.com test.loc www.test.loc DocumentRoot /var/www/test ServerAdmin me@some.com ErrorLog logs/error_log CustomLog logs/access_log combined </VirtualHost> ============ Spill from -S command line option: [root@server httpd]# httpd -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: _default_:8443 69.109.23.9 (/etc/httpd/conf.d/nss.conf:73) _default_:443 69.109.23.9 (/etc/httpd/conf.d/ssl.conf:81) _default_:* 69.109.23.9 (/etc/httpd/conf/httpd.conf:995) *:80 is a NameVirtualHost default server test.com (/etc/httpd/conf/httpd.conf:4) port 80 namevhost eswebs.com (/etc/httpd/conf/httpd.conf:4) Syntax OK |
You don't need the <VirtualHost _default_:*> for the vhost on port 80
Quote:
|
In the httpd.conf comment out these lines :
<VirtualHost _default_:*> DocumentRoot /var/www/apache/manual # DocumentRoot /var/www/eswebs </VirtualHost> NameVirtualHost *:80 and make sure this is the only virtual host section you have: <VirtualHost *:80> ServerName test.loc ServerAlias test.com www.test.com test.loc www.test.loc DocumentRoot /var/www/test ServerAdmin me@some.com ErrorLog logs/error_log CustomLog logs/access_log combined </VirtualHost> and it will work. |
All times are GMT -5. The time now is 05:27 AM. |