VPS侦探论坛

 找回密码
 注册
查看: 3190|回复: 1

nginx php subs_filter 优先级问题

[复制链接]
发表于 2016-7-7 01:12:04 | 显示全部楼层 |阅读模式

以前试过直接加到server{不管是在include enable-php.conf前加还是后面加,nginx都可以替换文字}
里面就行了,但目前最新版lnmp1.3对动态的文件不知道是不是nginx低于php优先级问题,只要是动态的nginx都不处理,就好像这个替换语句一样,,

location / {
subs_filter '源代码' '新代码' gi;
}

nginx只能替换静态文件,
假如把目前的index.php生成静态index.html 其他什么都不修改,
以上subs_filter 替换也可以生效的,






======================================================================================
以前0.9版本的替换代码# 不管是静态html或动态php都一样替换生效的,


server

  {

listen          80;
                        server_name 1.com;
                        index index.html index.htm index.php;

        root  /home/wwwroot/1.com;

error_page  404 = /index.php;


location /

{


subs_filter '源代码' '新代码' gi;

}


location ~ .*\.(php|php5)?$

{

try_files $uri =404;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fcgi.conf;

}




location ~ .*\.(gif|png|bmp|ico|js|css|swf|cur)?$

{

expires      30d;

}


access_log   off;
}


=============================================================




最新版1.3 静态index.html可以,动态php不可以...
===============================================================
server
    {
        listen 80;
        server_name 1.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/1.com;

#include enable-php.conf;  放到后面也不行??


location / {

subs_filter '源代码' '新代码' gi;
}
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

include enable-php.conf;
}
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-7-7 11:00:13 | 显示全部楼层

回复 1# 的帖子



你写自己确定好你自己的fastcgi_pass到底是用tcp还是socket,lnmp一直都是使用socket,而你发的第一个配置文件是用tcp
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-29 09:25 , Processed in 0.025172 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表