Nginx location 匹配规则

1. default_server:

当请求没有匹配到服务器中配置的任何一个server的时候,会默认把请求route到配置了default_server的virtual host中。参考地址:http://www.oschina.net/question/12_3565

2. upstream

用于实现多台服务器的负载均衡,

upstream app {
       server 10.0.6.108:81;
       server 10.0.6.109:82;
}

然后将server节点下的location节点中的proxy_pass配置为:http:// + upstream名称即可:

location / {
            root   html;
            index  index.html index.htm;
            proxy_pass http://app;
}

参考地址:http://favccxx.blog.51cto.com/2890523/1622091

3. Nginx配置location总结及rewrite规则写法

参考地址:http://seanlook.com/2015/05/17/nginx-location-rewrite/

原文地址:https://www.cnblogs.com/springdong/p/5618067.html