php, $_SERVER & server_name
Cliff Wells
cliff at develix.com
Tue Sep 1 01:21:04 MSD 2009
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
> fastcgi_param SERVER_NAME $http_host;
>
> i've had that in there forever.
>
> just like $uri is short for $request_uri right?
No, $uri and $request_uri are not always equal:
http://wiki.nginx.org/NginxHttpCoreModule#.24request_uri
http://wiki.nginx.org/NginxHttpCoreModule#.24uri
In short, $uri is the *current* URI (after rewrites, redirects, etc),
$request_uri is the *original* requested URI.
Regards,
Cliff
> this should be documented better somewhere
>
> 2009/8/31 Igor Sysoev <is at rambler-co.ru>:
> > On Mon, Aug 31, 2009 at 03:58:28PM -0500, AMP Admin wrote:
> >
> >> I'm trying to list a bunch of domains under server_name. I'm doing this
> >> because these domains generate dynamic content based on their name. it
> >> seems to work fine except for one thing... $_SERVER['SERVER_NAME'] just
> >> displays the first server_name entry.
> >>
> >> So say we have the following:
> >>
> >> server_name *.example1.com *.example2.com *.example3.com;
> >>
> >> echo $_SERVER['SERVER_NAME']; displays *.example1.com regardless which
> >> domain was entered into the browser.
> >
> > You need to change
> >
> > -fastcgi_param SERVER_NAME $server_name;
> > +fastcgi_param SERVER_NAME $host;
> >
> > in fastcgi_params.
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >
>
--
http://www.google.com/search?q=vonage+sucks
More information about the nginx
mailing list