nginx一个规则正则表达式的多个位置 [英] nginx multiple locations for one rule regex
本文介绍了nginx一个规则正则表达式的多个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图迫使nginx通过以下网址通过php-fpm进行处理:
I'm trying to force nginx to process through php-fpm following urls:
任何以
- .php
- /sitemap.xml
- /api/api.js
我正在尝试以下正则表达式,但是它不起作用:
I'm trying the following regex, but it does not work:
location ^~ ^((.*\.php)|/sitemap.xml)+$ {
推荐答案
尝试...
location ~ (\.php|sitemap\.xml|api/api\.js)$ {
...
}
这篇关于nginx一个规则正则表达式的多个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文