server_name host order
token
nginx-forum at nginx.us
Wed Nov 23 13:55:28 UTC 2011
Thank you for clearing this up. Thanks Again Maxim!
> Hello!
> On Wed, Nov 23, 2011 at 05:30:46AM -0500, token wrote:
> Hello, I would like to know if this is correct
>
> Will NGINX allways return the first of the provided hostname name in
> from the `server_name` as beign the "SERVER_NAME",
>
> eg server_name hostname1 hostname2;
> The $server_name variable is always first name as defined by the
> "server_name" directive in the server{} in question.
> With default fastcgi_params as shipped with nginx, SERVER_NAME as
> passed to php via fastcgi will be set to $server_name, i.e. first
> name defined with the "server_name" directive.
> I have two server blocks in this example
>
> server {
> listen 80;
> server_name www.example.co.uk *.example.co.uk;
> }
>
> the URI = http://something.example.co.uk/
>
> // PHP APPLICATION --------------
> I see as expected `SERVER_NAME` and `HTTP_HOST`
>
> SERVER_PORT => 80
> SERVER_NAME => www.example.co.uk
> HTTP_HOST => something.example.co.uk
> --------------
>
> server {
> listen 443;
> server_name www.example.co.uk secure.example.co.uk;
> }
>
> // PHP APPLICATION --------------
> again the `SERVER_NAME` and `HTTP_HOST` as i would expect
>
> the URI = https://secure.example.co.uk/
>
> // SERVER_PORT => 443
> // SERVER_NAME => www.example.co.uk
> // HTTP_HOST => secure.example.co.uk
> Yes, this is correct and expected behaviour.
> Maxim Dounin
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,218786,218825#msg-218825
More information about the nginx
mailing list