Welcome! Log In Create A New Profile


server_name host order

November 23, 2011 05:30AM
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_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
Subject Author Posted

server_name host order

token November 23, 2011 05:30AM

Re: server_name host order

Maxim Dounin November 23, 2011 08:44AM

Re: server_name host order

token November 23, 2011 08:55AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready