server_name host order

token nginx-forum at nginx.us
Wed Nov 23 10:30:46 UTC 2011


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;

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

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,218786,218786#msg-218786



More information about the nginx mailing list