Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试实施以下规则:
location ~ ^/stylesheets|javascripts|assets/
但是它匹配:
mysite.com/something/something/javascripts
我的想法是这个简单的正则表达式只会匹配。
mysite.com/javascripts
我希望它忽略嵌套,这里有什么问题?
您必须对 OR'ed 表达式进行分组:^/(stylesheets|javascripts|assets)/
^/(stylesheets|javascripts|assets)/
否则你会有三个稍微不同的潜在匹配:
/stylesheets
javascripts
assets/