Web Hosting Talk







View Full Version : Apache Name Based Site Configuration, Someone please help !


TechiBoy
06-28-2002, 04:19 AM
Hello

I am trying to configure httpd.conf manually for name based virtual sites.

IP based sites work without problem but as soon as I add a virtual name based site " all undefined sites resolved to server's shared IP go to that new site !!!!! except the domain that most go to it :angry:

Let me show you:


NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
ServerName atlas.com
DocumentRoot /home/atlas/public_html
ServerAlias *.atlas.com
Options ExecCGI Indexes
</VirtualHost>



As soon as I add above and restart httpd daemon all references resolved to 192.168.0.1 go to /home/atlas/public_html (including ip address 192.168.0.1 itself) except atlas.com. (I have put a html page in this directory with the text "welcome to atls.com")

When I type atlas.com (which resolves to 192.168.0.1 too) the following error comes to screen :


Directory Listing Denied
This Virtual Directory does not allow contents to be listed.


Can someone please help me with this nightmare?

Thank you

Techi

Techark
06-28-2002, 05:00 AM
You didn't say what version of Apache you are running but just for grins drop the *. in front of the domain and replace it with www.atlas.com atlas.com and see what happens.

All you really need to do is copy an IP based config that you know works and add NameVirtualHost 192.168.0.1 as the first line.

raj4800
06-28-2002, 05:34 AM
make sure whether that file is inyour default file configuration..checkout with the complete url like http://www.atlas.com/filename.html ...

or put that file name in DirectoryIndex ...for example

NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
ServerName atlas.com
DocumentRoot /home/atlas/public_html
DirectoryIndex index.html index.php index.jsp home.html
ServerAlias *.atlas.com
Options ExecCGI Indexes
</VirtualHost>

AnotherKen
06-28-2002, 06:30 AM
One more thing to mention. With that configuration all requests resolved to specified IP MUST go to /home/atlas..., cause the first listed virtual host is the default virtual host. If you would like to have a special configuration for requests that do not match any particular virtual host, simply put some default configuration in a <VirtualHost> container and list it first in the configuration file.

TechiBoy
06-28-2002, 09:39 AM
Thank you everyone. AnotherKen was right. I added a default VirtualHost to the begining of the list.

Everything fixed with below config:

NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
DocumentRoot /var/www/html
ServerName 192.168.0.1
Options ExecCGI Indexes
</VirtualHost>


<VirtualHost 192.168.0.1>
DocumentRoot /home/atlas/public_html
ServerName atlas.com
ServerAlias www.atlas.com
Options ExecCGI Indexes
</VirtualHost>