[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apache virtual host configuration...

On 4-jul-2008, at 10:05, Dietrich Bollmann wrote:


The syntax for virtual hosts configuration seems to have changed...

Until now I used the following syntax:
(taken from the configuration files in /etc/apache2/sites-enabled/)

  <VirtualHost *:80>

  <VirtualHost *>
    ServerName foo.bar

...which seems to not work anymore.

I could make the virtual host foo.bar work again by
changing the second configuration to

  <VirtualHost foo.bar>
    ServerName foo.bar

but now even http://localhost/ is directed to the default
page of the virtual host foo.bar...

How do I have to change the apache configuration files
to make things work again?

It's a little unclear what you're trying to accomplish, but I think you simply want one site for http://foo.bar and have any other request go to a default page. In that case you create two files in / etc/apache2/sites-available, one for the general site and one for the other. Both use the syntax:

    <Virtualhost *:80>

So both user '*:80' and both have a servername, since that won't be used to control the order in wich apache uses them to process requests. Then you use the command a2ensite (man a2ensite) to enable you sites, making sure they're in the right order, i.e. the default site first, the other last. The easiest way to do that is to use number prefixes in their names. That way, if the url is not known, apache will simply use the first file it finds in de sites dir and all your request that don't contain 'foo.bar' go to the default site.



Reply to: