You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christopher Malton <cj...@cjmweb.fsnet.co.uk> on 2005/04/10 08:52:06 UTC

[users@httpd] VirtualHosts not doing what I would like them to.

To all,
My VirtualHost directives in httpd.conf for Apache/2.0.53 are not
working as I would expect them to.

What I have is a default website set up on http://domain1.com, a second
on http://subdomain1.domain1.com and a third for unknown domain.  My
VirtualHost section of httpd.conf looks like this:

|--------BEGIN HTTPD.CONF Snippet---------|

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

<VirtualHost *:80>
    ServerAdmin webmaster@cjsoftuk.dyndns.org
    DocumentRoot /var/www_cjsoftuk/
    ServerName cjsoftuk.dyndns.org
    ErrorLog logs/cjsoftuk-error_log
    CustomLog logs/cjsoftuk-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@cjsoftuk.dyndns.org
    DocumentRoot /var/www/
    ServerName ultradownloader.dyndns.org
    ErrorLog logs/udl-error_log
    CustomLog logs/udl-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@cjsoftuk.dyndns.org
    DocumentRoot /var/www_unknown/
    ServerName *
    ErrorLog logs/unknown-error_log
    CustomLog logs/unknown-access_log common
</VirtualHost>

|--------END HTTPD.CONF Snippet---------|

The problem is that the third of these VirtualHost structures is not
working.  It should display index.html from the /var/www_unknown folder,
but it does not.  It just ignores it and displays index.html
from /var/www_cjsoftuk/  which is the folder for default website.

Please help me in this problem because I am new to Apache VirtualHost
settings and I could really do with some help.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHosts not doing what I would like them to.

Posted by Joshua Slive <js...@gmail.com>.
On Apr 10, 2005 2:52 AM, Christopher Malton <cj...@cjmweb.fsnet.co.uk> wrote:
> # The first VirtualHost section is used for requests without a known
> # server name.

I think you need to reread the above comment.

> The problem is that the third of these VirtualHost structures is not
> working.  It should display index.html from the /var/www_unknown folder,
> but it does not.  It just ignores it and displays index.html
> from /var/www_cjsoftuk/  which is the folder for default website.

List the "default" virtual host *first* in the config file and give it
the IP address as the ServerName (or any other name that doesn't
conflict with the rest of your vhosts).

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org