nginx-如何在一个位置使用多个子过滤器?
Nginx配置段:nginx-如何在一个位置使用多个子过滤器?,nginx,Nginx,Nginx配置段: location / { sub_filter_types text/plain; sub_filter hello hi; sub_filter 'hi' 'how are you'; sub_filter_once off; # First attempt to serve request as file, then
location / {
sub_filter_types text/plain;
sub_filter hello hi;
sub_filter 'hi' 'how are you';
sub_filter_once off;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
然后通过以下方式重新加载:
sudo nginx -s reload
然后得到警告:
nginx:[emerg]“sub_filter”指令在/etc/nginx/sites enabled/default:46中重复
我看到了类似的配置
问题是:
- 为什么会收到警告,多个子过滤器不能作为一个链一起使用
Nginx版本1.9.4中似乎添加了对单个位置中多个子过滤器方向的支持。您可能需要升级到更新的版本 可以在一个配置上指定多个子过滤器指令 级别(1.9.4)
但是,nginx文档没有提到这一点。我是通过ubuntu上的apt get安装的。而且,我猜不需要引用,因为每个部分都没有空间。啊。我懂了。这些引语只是一种好奇,如果这可能是问题所在的话。这个问题似乎与Florin Andrei在nginx邮件列表上的问题非常相似。好的,nginx默认情况下不支持多个子过滤器作为一个链。