You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mark Van Crombrugge <ma...@vliz.be> on 2009/01/29 18:09:00 UTC
[users@httpd] Apache2 only serves first virtualhost
I moved some websites from an Apache1 to an Apache2 server which was
allready hosting one site (defined by a colleague some months ago).
Added the second site to the httpd.conf file but the first one is
allways served, even when typing the URL of the second one.
If you change the position of the sites in the httpd.conf, it is
obvious that it is allways the first site who is served.
Must have defined about 40-50 websites on a multitude of servers and
never had this problem.
I can not ask my colleague what he changed in the original config file
because he is on sick leave for many months to come.
I joined three versions of the config files and the output of 'httpd -
S' : any hint that can make me see the light and get this to work will
make my week!
Also replaced "*.80" with "<ipaddress>:80" and just "<ipaddress>",
same result.
If I copy this to an Apache1 server, it works...
Thanks in advance for helping a frustrated IT dude.
Mark
CHECKED FIRST HTTPD.CONF WITH HTTPD -S:
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:8443 server1.test.org (/etc/httpd/conf.d/nss.conf:73)
_default_:443 server1.test.org (/etc/httpd/conf.d/ssl.conf:81)
*:80 is a NameVirtualHost
default server www.website1.org (/etc/httpd/conf/httpd.conf:
1050)
port 80 namevhost www.website1.org (/etc/httpd/conf/
httpd.conf:1050)
port 80 namevhost www.website2.org (/etc/httpd/conf/
httpd.conf:1075)
port 80 namevhost www.website3.org (/etc/httpd/conf/
httpd.conf:1088)
Syntax OK
-----------------
FIRST HTTPD.CONF, no mather which URL one browses for, "First Website"
is allways served.
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
# First Website
<Virtualhost *:80>
Documentroot /var/www/html/www.website1.org
ServerName www.website1.org
ServerAlias website1.org
</Virtualhost>
#Second Website
<Virtualhost *:80>
Documentroot /var/www/html/website2
ServerName www.website2.org
ServerAlias website2.org
</Virtualhost>
----------------
Second HTTPD.CONF, no mather which URL one browses for, "Second
Website" is allways served.
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#Second Website
<Virtualhost *:80>
Documentroot /var/www/html/website2
ServerName www.website2.org
ServerAlias website2.org
</Virtualhost>
# First Website
<Virtualhost *:80>
Documentroot /var/www/html/www.website1.org
ServerName www.website1.org
ServerAlias website1.org
</Virtualhost>
----------------
Third HTTPD.CONF, no mather which URL one browses for, "Third Website"
is allways served.
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#Third Website
<Virtualhost *:80>
Documentroot /var/www/html/website3
ServerName www.website3.org
ServerAlias website3.org
</Virtualhost>
#Second Website
<Virtualhost *:80>
Documentroot /var/www/html/website2
ServerName www.website2.org
ServerAlias website2.org
</Virtualhost>
# First Website
<Virtualhost *:80>
Documentroot /var/www/html/www.website1.org
ServerName www.website1.org
ServerAlias website1.org
</Virtualhost>
----------------
---------------------------------------------------------------------
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] Apache2 only serves first virtualhost
Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 29.01.09 18:09, Mark Van Crombrugge wrote:
> I moved some websites from an Apache1 to an Apache2 server which was
> allready hosting one site (defined by a colleague some months ago).
> Added the second site to the httpd.conf file but the first one is
> allways served, even when typing the URL of the second one.
>
> If you change the position of the sites in the httpd.conf, it is
> obvious that it is allways the first site who is served.
Seems like NameVirtualHost is missing.
Are you sure apache2 uses the same config file?
What do logs say?
--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Linux - It's now safe to turn on your computer.
Linux - Teraz mozete pocitac bez obav zapnut.
---------------------------------------------------------------------
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] Apache2 only serves first virtualhost
Posted by Krist van Besien <kr...@gmail.com>.
On Thu, Jan 29, 2009 at 6:09 PM, Mark Van Crombrugge
<ma...@vliz.be> wrote:
> Third HTTPD.CONF, no mather which URL one browses for, "Third Website" is
> allways served.
>
> NameVirtualHost *:80
> #
> # NOTE: NameVirtualHost cannot be used without a port specifier
> # (e.g. :80) if mod_ssl is being used, due to the nature of the
> # SSL protocol.
>
> #Third Website
> <Virtualhost *:80>
> Documentroot /var/www/html/website3
> ServerName www.website3.org
> ServerAlias website3.org
> </Virtualhost>
>
> #Second Website
> <Virtualhost *:80>
> Documentroot /var/www/html/website2
> ServerName www.website2.org
> ServerAlias website2.org
> </Virtualhost>
>
> # First Website
> <Virtualhost *:80>
> Documentroot /var/www/html/www.website1.org
> ServerName www.website1.org
> ServerAlias website1.org
> </Virtualhost>
At first glance this is all correct, and should work. But it doesn't
you tell us...
NameVirtualHost relies on features in HTTP 1.1. It could be that the
requests your server are receiving are not HTTP .1.0.
Could you test your site from the machine itself, using something like curl?
curl -v "www.webiste1.org" should give you the startpage of the third
website. If it does, than there is nothing wrong with your apache, and
the problem is somewhere else.
If your servert is the problem then you should look at something that
might be sabotaging your webserver's ability to find the right virtual
host.
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
---------------------------------------------------------------------
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] Apache2 only serves first virtualhost
Posted by Norman Peelman <np...@cfl.rr.com>.
Mark Van Crombrugge wrote:
> Thanks for the hint.
> I changed the "Documentroot" to "DocumentRoot" but it makes no
> difference.
>
> This phenomenon is very strange and only occurs one one of our many
> servers.
> If I don't find a solution soon, I will copy a httpd.conf file from
> another machine and if that doesn't do the trick, reinstall Apache
> from scratch.
>
> But any hints and ideas are very welcome because I prefer the discover
> what causes this and learn from it, compared to starting from scratch
> and staying dumb.
>
>
>
>
>
> On 29 Jan 2009, at 18:29, Simon Young wrote:
>
>> On Thu, Jan 29, 2009 at 06:09:00PM +0100, Mark Van Crombrugge wrote:
>>>
>>> FIRST HTTPD.CONF, no mather which URL one browses for, "First Website"
>>> is allways served.
>>>
>>> # First Website
>>> <Virtualhost *:80>
>>> Documentroot /var/www/html/www.website1.org
>>> ServerName www.website1.org
>>> ServerAlias website1.org
>>> </Virtualhost>
>>
>>
>> Could it just be a case-sensitivity issue? Try changing the document
>> root directive to 'DocumentRoot' instead of 'Documentroot'.
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
It's got to be something really simple you're overlooking. Maybe use
Firefox w/liveheaders addon to see what's going on.
--
Norman Registered Linux user #461062 -Have you been to www.apache.org yet?-
---------------------------------------------------------------------
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] Apache2 only serves first virtualhost
Posted by Mark Van Crombrugge <ma...@vliz.be>.
Thanks for the hint.
I changed the "Documentroot" to "DocumentRoot" but it makes no
difference.
This phenomenon is very strange and only occurs one one of our many
servers.
If I don't find a solution soon, I will copy a httpd.conf file from
another machine and if that doesn't do the trick, reinstall Apache
from scratch.
But any hints and ideas are very welcome because I prefer the discover
what causes this and learn from it, compared to starting from scratch
and staying dumb.
On 29 Jan 2009, at 18:29, Simon Young wrote:
> On Thu, Jan 29, 2009 at 06:09:00PM +0100, Mark Van Crombrugge wrote:
>>
>> FIRST HTTPD.CONF, no mather which URL one browses for, "First
>> Website"
>> is allways served.
>>
>> # First Website
>> <Virtualhost *:80>
>> Documentroot /var/www/html/www.website1.org
>> ServerName www.website1.org
>> ServerAlias website1.org
>> </Virtualhost>
>
>
> Could it just be a case-sensitivity issue? Try changing the document
> root directive to 'DocumentRoot' instead of 'Documentroot'.
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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] Apache2 only serves first virtualhost
Posted by Simon Young <si...@excession.net>.
On Thu, Jan 29, 2009 at 06:09:00PM +0100, Mark Van Crombrugge wrote:
>
> FIRST HTTPD.CONF, no mather which URL one browses for, "First Website"
> is allways served.
>
> # First Website
> <Virtualhost *:80>
> Documentroot /var/www/html/www.website1.org
> ServerName www.website1.org
> ServerAlias website1.org
> </Virtualhost>
Could it just be a case-sensitivity issue? Try changing the document
root directive to 'DocumentRoot' instead of 'Documentroot'.
---------------------------------------------------------------------
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