[opensuse] (Strange) Apache Virtual Host Behaviour

Hi all,

So, I setup Apache on my OpenSUSE 11.4 server at home, wanting to
experiment with several php and perl apps (hence the Virtual Hosting
config), when I found some strange behaviour with Virtual Hosting.

I have a default configuration in Apache which I can access using
hostorig.domain.tld (not the real name of course). I create a Virtual
Host, host1.domain.tld and put an index.html inside. It works, so far so

Ok, now, I add another Virtual Host, host2.domain.tld, and things start
to get strange. When I open a browser and go to "http://hostorig";, I get
"http://host1"; instead. "http://host1"; still points to the right place,
and "http://host2"; point to the right place too.

A bit of Googling around leads me to a site that says that the order of
the <VirtualHost> stanzas is significant. If Apache does not understand
which Virtual Host the user is requesting, it will default to the first
<VirtualHost> declaration.

Now, in OpenSUSE, the order of the Virtual Hosts is not so clear because
they are all contained in separate .conf files inside
/etc/apache2/vhost.d. If I wanted one of the Virtual Hosts here to be
the "first" Virtual Host declared, what do I do?

Since this is a home setup, it's not really that important, but it is
annoying me like crazy. If anyone here can give me any information on
why all this is happening and how I can setup a Virtual Host that Apache
will "default" to when it doesn't understand the destination (or just
setup Virtual Hosts better), please help!

Thanks in Advance,
pascal chong

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

Relevant Pages

  • RE: Apache Virtual Host
    ... you can also put an Include directive in the VirtualHost block. ... Subject: Apache Virtual Host ... have to load your default server as a vhost as well or you won't be able to ...
  • Re: [users@httpd] Re: cgi-bin stopped working in apache ?! please help SOLVED
    ... so now, when Apache starts, it "includes" the configuration of your new ... (It is the new default because it is now the first defined virtual host in ... terms to ServerAlias and that is what screwed me up. ... So whenever a Virtual Host "needs" a parameter value, and it is not explicitly defined in his own <VirtualHost> section, it will use the default parameter value as defined before the "NameVirtualHost" line. ...
  • Re: Virtual hosting with squirrelmail & apache
    ... > Apache was downloaded when I apt-get installed squirrelmail and setup ... Usually the first virtual host will become the ... allow only connections to the squirrelmail virtualhost over ssl, ...
  • Re: Apache virtual host problem Half solved
    ... NameVirtualHost for me on the first line of every VirtualHost then ... You just leave NameVirtualHost for the first Virtual Host ... You scratch my back, I'll scratch yours :-) ...
  • Re: Apache Virtual Server
    ... You've got a wildcard in every "VirtualHost" declaration. ... The ServerName and ServerAlias directives inside each virtual host is ... And your server would have to have just a single address, ... They've got the same hostname associated with two different IP ...