Back

nginx - 一个location对应多个rule

发布时间: 2019-04-23 07:21:00

参考:https://stackoverflow.com/questions/35320674/how-can-i-have-same-rule-for-two-locations-in-nginx-config

两种办法:

1. 使用pattern: 

location ~ ^/(verbs|example_entries|admin/dashboa.. ) 

2. 抽取出一个通用文件,然后include: 

server {
    location /first/location/ {
        include shared.conf;
    }
    location /second/location/ {
        include shared.conf;
    }
}

Back