php, $_SERVER & server_name

Cliff Wells cliff at develix.com
Tue Sep 1 20:31:19 MSD 2009


On Tue, 2009-09-01 at 08:40 +0400, Igor Sysoev wrote:
> On Mon, Aug 31, 2009 at 02:21:04PM -0700, Cliff Wells wrote:
> 
> > On Mon, 2009-08-31 at 14:07 -0700, Michael Shadle wrote:
> > > $host is the same as $http_host?
> > 
> > Yes, because $http_HEADER is available for *all* headers, so even though
> > there's already a $host variable, it's also available via the
> > generalized $http_host variable:
> > 
> > http://wiki.nginx.org/NginxHttpCoreModule#.24host
> > http://wiki.nginx.org/NginxHttpCoreModule#.24http_HEADER
> 
> No, $host gets its value from
> 
> 1) request line - http://HOST/...,
> 2) $http_host,
> 3) $server_name if reques has no "Host" header line.

Ah, so $http_host could conceivably be different from $host as well.

Thanks.

Cliff






More information about the nginx mailing list