On Sunday 07 May 2006 22:38, Arun K. Khan wrote:
Using SuSE 10.0, Apache 2.0.54. Looked through the Apache online manual on setting up virtual hosts and created a vhosts.conf file - mostly copy/paste from a template (see listing below).
wow. i too was busy setting up virtual hosts on my debian server today.
I restarted apache and bind daemons after changes to their respective files.
http://genesis works fine and shows index.html in "/home/www/html" but ... http://linux-install shows the same index.html as above instead of the directory listing of the Linux distribution tree I have installed @ /mnt/C.
I have tried replacing * with IP# but same result. Defining "linux-inNameVirtualHost *:80
Since I am using Apache 1.3.31 I dont have a vhosts.conf. Heres the relevant part of my httpd.conf:
--------------------------------------------------------------------- NameVirtualHost *:80
<VirtualHost *> ServerName localhost ServerAdmin webmaster@localhost DocumentRoot /var/www/ ErrorLog /var/log/apache/error.log CustomLog /var/log/apache/access.log combined ServerAlias 192.168.0.1 www.mydomain.org </VirtualHost>
<VirtualHost *> ServerName test.mydomain.org ServerAdmin webmaster@test.mydomain.org DocumentRoot /var/www/test-mydomain-web/
<Directory /var/www/test-mydomain-web/> Options Indexes Includes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
ErrorLog /var/log/apache/test.mydomain.org-error.log CustomLog /var/log/apache/test.mydomain.org-access.log common </VirtualHost>
<VirtualHost *> ServerName <My External IP> ServerAdmin webmaster@localhost DocumentRoot /var/www/restricted-web/ ErrorLog /var/log/apache/restricted-web-error.log CustomLog /var/log/apache/restricted-web-access.log common </VirtualHost> ---------------------------------------------------------------------
It seems that apache defaults to the first vhost if it doesnt find a matching HOST in the http header. I've simply setup the "restricted-web" entry to prevent anybody from directly using my IP to access the server. I want people only to use my domain name to refer to it. As this server can serve external requests as well as internal ones. I want it to serve a different website for the intranet as opposed to the internet so I have two different vhost entries. I dunno whether this is the right way to do it but it worked for me.
Any ideas/suggestions on could be missing in my setup?
I really cant say because the above setup works for me in Debian Sarge with Apache 1.3.31. BTW you can check your vhost config by running apache -S