Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 106806 - Apache 2: missing ServerName directive in default vhost configuration
Summary: Apache 2: missing ServerName directive in default vhost configuration
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-21 08:54 UTC by Julien Allanos (RETIRED)
Modified: 2006-06-04 20:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Allanos (RETIRED) gentoo-dev 2005-09-21 08:54:02 UTC
Well, I might be wrong here, but with the current configuration I'm unable to
make other vhosts than the default one work.

I have set -D DEFAULT_VHOST, and here is how my /etc/apache2/vhosts.d/ looks like:

00_default_vhost.conf
host.domain.tld.conf

host.domain.tld.conf has the following configuration:

<VirtualHost *:80>
  ServerName host.domain.tld
  DocumentRoot /var/www/host.domain.tld/htdocs
  [...]
</VirtualHost>

If I left 00_default_vhost.conf untouched, and try to access
http://host.domain.tld/, I get the default vhost webpage (Seeing this...?). Strange.

Now if I add, say, "ServerName localhost" inside the default vhost configuration
in 00_default_vhost.conf, I can access the host.domain.tld htdocs thru
http://host.domain.tld/, and the default vhost pages thru http://host/ or
http://ip.ad.dre.ss/, as expected.

Tested with apache-2.0.54-r31.

Thoughts?
Comment 1 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2005-10-09 12:25:30 UTC
This may be stating the obvious, but did you remember to restart apache? The
page may also be cached locally in your browser.

Name based vhosts work as follows:

Apache uses the Host: HTTP header
If there is a vhost that has a ServerName or ServerAlias directive, it uses that
vhost. If there is no vhost that explicetly states that, it uses the first vhost
it finds that doesn't have a ServerName defined. If the case of gentoo, it
should be the vhost in 00_default_vhost.conf (as long as -D DEFAULT_VHOST is in
APACHE2_OPTS).

Comment 2 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2006-06-04 20:52:11 UTC
Unable to reproduce and no response from the reporter. Closing.