Mailinglist Archive: opensuse (714 mails)

< Previous Next >
[opensuse] (Strange) Apache Virtual Host Behaviour
  • From: CHONG Yu Meng <chongym@xxxxxxxxxxxxxx>
  • Date: Mon, 10 Oct 2011 22:23:49 +0800 (SGT)
  • Message-id: <684969075.346.1318256629684.JavaMail.root@heloise>
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

< Previous Next >
Follow Ups