Erver_name corresponds to the server_name in the Nginx configuration file by Fastcgi_param settings, such as the domain name pointing to IP instead of setting the corresponding nginx in server_name,php for null server_name. If there are multiple server_name, take the first one.
Example
| The code is as follows |
Copy Code |
|
server_name www.111cn.net;
Fastcgi_param server_name $server _name; |
Http_host is included in the HTTP request information, that is, the requested domain name or the Ip,nginx within the host.
The difference between http_host and server_name:
One: The following three conditions are met:
1. Server Port Default 80
ServerName set correctly in 2.apache or Nginx
3.http/1.1 Protocol Specification
Two: Different points:
$_server[' http_host ' will output information based on client HTTP requests
$_server[' Server_nane ' will be based on the servername value in the Apache or nginx configuration file
When the port is not 80 o'clock
The $_server[' http_host ' output will have a port number
$_server[' server_name ' will only output servername values directly
Therefore, should try to use $_server["Http_host"], insurance, reliable!