Welcome! Log In Create A New Profile

Advanced

SERVER_HOST value incorrect?

Posted by unixro 
SERVER_HOST value incorrect?
March 30, 2012 11:30AM
Right now i have nginx 0.8.54. Configuration was :
server_name _; but even with with listen 80 default; or server_name "" ; behavior seems incorrect.
Normally if you have default virtual host and you access the server via ip then SERVER_NAME should return an ip address or if a domain is mapped that domain to be returned. Right now it returns what is set as server_name which seems incorrect behavior to me, which is "" or _ depending to what is set.
More if you have:
server_name set to example.com and www.example.com; It'll always return example.com
Is there any way to set the fastcgi_param so that SERVER_NAME is set to the HOST from client request, or to default on SERVER_ADDR if this is not found?
Re: SERVER_HOST value incorrect?
April 11, 2012 11:03AM
go to fastcgi_params and

fastcgi_param SERVER_NAME $server_name;

change $server_name to $host.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready