Let’s look at a more complex configuration where some virtual servers listen on different addresses:
让我们看一个更复杂的配置文件,它的一些虚拟服务器监听不同的地址,如下:
分别监听了192.168.1.1:80和192.168.1.2:80
server { listen 192.168.1.1:80; server_name example.org www.example.org; ... } server { listen 192.168.1.1:80; server_name example.net www.example.net; ... } server { listen 192.168.1.2:80; server_name example.com www.example.com; ... }
In this configuration, nginx first tests the IP address and port of the request against the listen directives of the server blocks.
在这个配置文件中,nginx首先根