RE: VirtualHost with no ServerName in 2.2.11

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

 



Thanks for the reply.

What we are trying to do is to create a new vhost without disrupting the default settings.

So that http://localhost/whatever/... Follow the default setup while
http://localhost/testsite/... Will refer to /var/www/company/yyy/public


I did look into the suggested link but most examples on multiple vhosts rely on either different port, different ip address, or different name but in our case they are all the same. It is just a path that we want to take over.

I realize the default DocumentRoot /var/www takes over all requests, and I am just wonder if there is a way override it just for a particular path "testsite". Or do we always need to edit the default config?

Editing the default config is fine for a particular server but we are working on a web application, to be deployed on different machines. Would be nice if we could just add our own vhost configuration without messing with the default.


Thanks!


-----Original Message-----
From: André Warnier [mailto:aw@xxxxxxxxxx] 
Sent: Thursday, May 14, 2009 1:37 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  VirtualHost with no ServerName in 2.2.11

Tony Ser wrote:
> Hi,
> 
> We are developing a web application and need to create a website.
> The testsite.conf contains
> 
> Namevirtualhost *:80
> <VirtualHost *:80>

ServerName ?????

> AllowEncodedSlashes On

DocumentRoot ????  ----|
                        |
                        v

> Alias /testsite "/var/www/company/yyy/public"
> <Directory "/var/www/company/yyy/public">
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
> 
> 
> We don't want to specify a fix IP Address, so we leave it with *.
> This works fine under Apache 2.2.8 (in Ubuntu 8.04)
You mean the above config ? or just the "*" ?

> However, under Apache 2.2.11 (in Ubuntu 9.04), the settings are not
> ineffect.
> 
> If we browse http://localhost/testsite/test.html, error log shows apache
> trying to access /var/www/testsite/test.html instead of
> /var/www/company/yyy/public/test.html
> 
Probably only because your main configuration says
DocumentRoot /var/www
and by default, it carries over to the <VirtualHost>

> If I add "ServerName localhost", then it will work.
>
If that's the only thing you're adding, then you're lucky.

> Is there a way specify a site configuration (i.e. AllowEncodedSlashes,
> Alias, etc) with out specifying a fixed IP Address or fixed ServerName.
> 

If you have only one <VirtualHost> section, then it does not matter what
you give it as ServerName.  Pages will always be served by this VirtualHost,
because it will be the default one.

As for fixed IP address, I don't really understand what you mean.
For that, it seems that your configuration above is fine.  This Apache 
will respond to any request that reaches it on port 80, no matter 
through which one of its (possible) IP addresses.


I believe you might benefit from reading through
http://httpd.apache.org/docs/2.2/vhosts/
and try to get a basic understanding of this stuff first.

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux