如图,nginx的server_name并没有配置的域名为什么也能转发?

server_name只是配置了e-house.cn www.e-house.cn
为什么输入louqibang.com的时候,也一样会转发到ehouse这个项目?
图片描述

回答:

这个问题在nginx文档中可以找到原因

If a server is the only server for a listen port, then nginx will not test server names at all (and will not build the hash tables for the listen port). However, there is one exception. If a server name is a regular expression with captures, then nginx has to execute the expression to get the captures.

也就是说,如果某个端口下只有一个server_name的时候,所有访问该端口的请求,不管server_name是什么,都会由该server块处理。

请看 Server Names

以上是 如图,nginx的server_name并没有配置的域名为什么也能转发? 的全部内容, 来源链接: utcz.com/p/178521.html

回到顶部