为什么^~不停止在nginx中处理路由规则?

为什么^~不停止在nginx中处理路由规则?,nginx,webserver,rewrite,Nginx,Webserver,Rewrite,因此,我有两条路线,第一条路线不会停止路线匹配,正如文档所说: location ^~ /p/ { root /www/domain.com/; try_files $uri $uri/ /path/index.html; } location ^~ /v/ { root /www/domain.com/; try_files $uri $uri/ /path/index.html; } location ^~ / { root /www/domain

因此,我有两条路线,第一条路线不会停止路线匹配,正如文档所说:

location ^~ /p/ {
    root /www/domain.com/;
    try_files $uri $uri/ /path/index.html;
}

location ^~ /v/ {
    root /www/domain.com/;
    try_files $uri $uri/ /path/index.html;
}

location ^~ / {
    root /www/domain.com/php_www/;
    try_files $uri $uri/ /index.php;

        location ~* \.(?:php|html)$ {   
            try_files $uri =404;
            fastcgi_pass 127.0.0.1:9000;
            include /etc/nginx/fastcgi_params;
        }

        auth_basic "Staging";
        auth_basic_user_file /www/.htpasswd;

}
因此,如果我有这样一个url:

http://domain.com/p/1234567890
它匹配最后一条路线,而不是第一条路线。问题的出现是因为我们的一个同事在应用程序中添加了一个页面:

http://domain.com/privacy
这是第一条路线的乘客吗??这就是问题的根源

我遇到的问题是^~。在文档中,它表示一旦匹配,它将停止匹配,但是最后一条路由始终是加载的路由


有什么想法吗?

升级到最新的nginx,并重新订购了一些指令,现在一切正常。

供参考:我已经测试了一段时间了。该问题似乎与nginx未检查第一条路线中的最终路线有关。所以我可以做^ ~/p,它工作正常,但是/privacy页面无法加载。但当要匹配的路由为^~/p/时,它不起作用。这跟这该死的尾随斜杠有关!升级到最新的nginx,并重新订购了一些指令,现在一切正常。