You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vinay Purohit <Vi...@trianz.com> on 2008/06/05 08:50:36 UTC

[users@httpd] Apache Virtual Server Configuration

Hi 
 
Is it mandatory to have first virtual server block as main server when
we configure name based virtual server on apache2.2.8  ?
Creation of virtual servers: While creating virtual servers on apache
2.2.8 we have to include a virtual host block for each virtual server we
want to create and one virtual host block for main server which should
be kept at top of all blocks. The reason and description are shown in
the mentioned link.
http://httpd.apache.org/docs/2.2/vhosts/name-based.html 

please suggest if any work around ?

 

\Vinay

 

 

 

Re: [users@httpd] Apache Virtual Server Configuration

Posted by Dragon <dr...@crimson-dragon.com>.
Vinay Purohit wrote:
>Hi
>
>Is it mandatory to have first virtual server block as main server 
>when we configure name based virtual server on apache2.2.8  ?
>
>Creation of virtual servers: While creating virtual servers on 
>apache 2.2.8 we have to include a virtual host block for each 
>virtual server we want to create and one virtual host block for main 
>server which should be kept at top of all blocks. The reason and 
>description are shown in the mentioned link. 
><http://httpd.apache.org/docs/2.2/vhosts/name-based.html>http://httpd.apache.org/docs/2.2/vhosts/name-based.html 
>
>
>please suggest if any work around ?
>
>\Vinay
---------------- End original message. ---------------------

There isn't a work around, that is how it operates. The first virtual 
host block is always the default and will be served if no other host 
name matches.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
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] Apache Virtual Server Configuration

Posted by André Warnier <aw...@ice-sa.com>.
Hi.

I believe the problem may be one of understanding, not one of configuration.
If you have a configuration with VirtualHost's, there is not really a 
"main server".  All VirtualHost's are created equal.

The configuration commands and parameters that are outside of a 
<VirtualHost> section act as defaults for Apache in general.

The commands/parameters inside a <VirtualHost> override the defaults, 
for the VirtualHost in which they are found. If you do not override a 
parameter, then the default for that parameter applies.
That is true for the ServerName as well.

The only thing special with the first named VirtualHost, is that when a 
request comes in, and Apache does not find a <VirtualHost> section whose 
ServerName matches the request, then it will use the configuration of 
the first defined <VirualHost> section to answer this request.

So, the first defined VirtualHost is not a "main" server.  It is just a 
normal VirtualHost.  If that first <VirtualHost> section does not 
contain many configuration commands, then it may "look" to you like it 
is a "main server", because it is using all the defaults that have been 
defining outside of <VirtualHost> sections.

Another way to look at it is this :
The configuration of the first defined VirtualHost will be used to serve 
all requests that arrive to your (physical) server with a wrong 
hostname.  There 2 cases where this may happen :
1) the user tries to access your server using it's IP address (like 
"http://123.23.23.45"), which he probably should not do.
2) the DNS system has a problem, and is returning the IP address of your 
server, for a hostname that has nothing to do with your server.
That is also probably not correct.


Vinay Purohit wrote:
>  thanks matt 
> Is it mandatory or not to have first vh as main server ? If we do not put first vh as main server how can I acess a main server resources.
> 
> \Vinay
> -----Original Message-----
> From: matt.farey@gmail.com [mailto:matt.farey@gmail.com] 
> Sent: Thursday, June 05, 2008 12:29 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Apache Virtual Server Configuration
> 
> The first v.h. block is important in that any request for a host (servername) that is not found in any other vh block defaults to the first block.
> 
> So on my servers in the top most block all requests are rewritten to a "please check the url" page.
> 
> Sent from my BlackBerry® wireless device
> 
> -----Original Message-----
> From: "Vinay Purohit" <Vi...@trianz.com>
> 
> Date: Thu, 5 Jun 2008 12:20:36
> To:<us...@httpd.apache.org>
> Subject: [users@httpd] Apache Virtual Server Configuration
> 
> Hi 
>   
> Is it mandatory to have first virtual server block as main server when we configure name based virtual server on apache2.2.8  ? 
>  
> Creation of virtual servers: While creating virtual servers on apache 2.2.8 we have to include a virtual host block for each virtual server we want to create and one virtual host block for main server which should be kept at top of all blocks. The reason and description are shown in the mentioned link. http://httpd.apache.org/docs/2.2/vhosts/name-based.html <http://httpd.apache.org/docs/2.2/vhosts/name-based.html>
> please suggest if any work around ? 
>   
> \Vinay 
>   
>   
>  
> 
> ---------------------------------------------------------------------
> 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] Apache Virtual Server Configuration

Posted by Vinay Purohit <Vi...@trianz.com>.
 thanks matt 
Is it mandatory or not to have first vh as main server ? If we do not put first vh as main server how can I acess a main server resources.

\Vinay
-----Original Message-----
From: matt.farey@gmail.com [mailto:matt.farey@gmail.com] 
Sent: Thursday, June 05, 2008 12:29 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache Virtual Server Configuration

The first v.h. block is important in that any request for a host (servername) that is not found in any other vh block defaults to the first block.

So on my servers in the top most block all requests are rewritten to a "please check the url" page.

Sent from my BlackBerry® wireless device

-----Original Message-----
From: "Vinay Purohit" <Vi...@trianz.com>

Date: Thu, 5 Jun 2008 12:20:36
To:<us...@httpd.apache.org>
Subject: [users@httpd] Apache Virtual Server Configuration

Hi 
  
Is it mandatory to have first virtual server block as main server when we configure name based virtual server on apache2.2.8  ? 
 
Creation of virtual servers: While creating virtual servers on apache 2.2.8 we have to include a virtual host block for each virtual server we want to create and one virtual host block for main server which should be kept at top of all blocks. The reason and description are shown in the mentioned link. http://httpd.apache.org/docs/2.2/vhosts/name-based.html <http://httpd.apache.org/docs/2.2/vhosts/name-based.html>
please suggest if any work around ? 
  
\Vinay 
  
  
 

---------------------------------------------------------------------
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] Apache Virtual Server Configuration

Posted by ma...@gmail.com.
The first v.h. block is important in that any request for a host (servername) that is not found in any other vh block defaults to the first block.

So on my servers in the top most block all requests are rewritten to a "please check the url" page.

Sent from my BlackBerry® wireless device

-----Original Message-----
From: "Vinay Purohit" <Vi...@trianz.com>

Date: Thu, 5 Jun 2008 12:20:36 
To:<us...@httpd.apache.org>
Subject: [users@httpd] Apache Virtual Server Configuration

Hi 
  
Is it mandatory to have first virtual server block as main server when we configure name based virtual server on apache2.2.8  ? 
 
Creation of virtual servers: While creating virtual servers on apache 2.2.8 we have to include a virtual host block for each virtual server we want to create and one virtual host block for main server which should be kept at top of all blocks. The reason and description are shown in the mentioned link. http://httpd.apache.org/docs/2.2/vhosts/name-based.html <http://httpd.apache.org/docs/2.2/vhosts/name-based.html>  
please suggest if any work around ? 
  
\Vinay