简体   繁体   English

为什么^〜不能停止在Nginx中处理路由规则?

[英]why does ^~ not stop processing routing rules in nginx?

So I've got 2 routes, and the first one doesn't stop the route matching, as the docs say it should: 因此,我有2条路线,而第一个路线并没有停止路线匹配,正如文档所述:

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;

}

So if I have a url like this: 因此,如果我有这样的网址:

http://domain.com/p/1234567890

It matches the last route and not the first route. 它匹配最后一条路线,而不是第一条路线。 The problem surfaced because one of our guys added a page to the application: 问题浮出水面是因为我们其中的一个人向应用程序添加了一个页面:

http://domain.com/privacy

This was picked up by the FIRST route?? 这是由第一条路线捡到的? Which is where the problem is coming from. 问题出在哪里。

The problem I'm having is with ^~. 我遇到的问题是^〜。 In the docs, it says that once this matches, it will stop matching, however the last route is always the one that loads. 在文档中,它说一旦匹配,它将停止匹配,但是最后一条路线始终是加载的路线。

Any ideas? 有任何想法吗?

升级到最新的nginx,并对某些指令进行了重新排序,一切都可以正常工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM