I would like to ask what is the relationship between the mappings in the hosts in Windows and the host of the server configured in Nginx? When using the browser to access, whether the domain name first in the Hosts file to find, and then through the IP address to access resources, then Nginx will not match the request (because it is an IP address)?
Reply to discussion (solution)
Nginx in the server_name will also go through the hosts, see if the corresponding, the hosts is equivalent to a small domain name server. That should be it.
You enter a URL in the browser will check your local hosts file if there is a mapping, directly through the mapped IP access to your Web server (this is Nginx) when the request was received by Nginx He's going to check it. The requested domain name and servername are matched, and the match is returned based on the corresponding configuration, and the content is returned according to the default configuration if no match is reached.
I would like to ask what is the relationship between the mappings in the hosts in Windows and the host of the server configured in Nginx? When using the browser to access, whether the domain name first in the Hosts file to find, and then through the IP address to access resources, then Nginx will not match the request (because it is an IP address)?
The resource is accessed through IP, but Nginx will find the hostname inside the request header to match the one that needs to handle the response.
Get/rabbit/tracking-ad/main.js.map http/1.1host:csdnimg.cn//Note this, Nginx will be based on this matching servernameconnection: keep-alivecache-control:max-age=0user-agent:mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/41.0.2272.118 safari/537.36accept: */*referer:http:// Bbs.csdn.net/forums/phpaccept-encoding:gzip, deflate, sdchaccept-language:zh-cn,zh;q=0.8
If there is no host in the request header, Nginx will also find the configuration to handle the request in order, the general default port 80 is open and will match to the default configuration.