lnmp 反代并替换内容
一、安装lnmp
wget http://soft.vpser.net/lnmp/lnmp1.5.tar.gz -cO lnmp1.5.tar.gz && tar zxf lnmp1.5.tar.gz && cd lnmp1.5 && ./install.sh lnmp
二、添加域名
lnmp vhost add
三、安装http_substitutions_filter_module
[root@MyServer ~]# wget -O ngx_http_substitutions_filter_module-master.zip https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/master.zip [root@MyServer ~]# unzip ngx_http_substitutions_filter_module-master.zip [root@MyServer ~]# cd ngx_http_substitutions_filter_module-master && pwd
修改/root/lnmp1.5/lnmp.conf文件
在 Nginx_Modules_Options 参数的引号里加其他需要的参数(一般添加第三方模块的话是–add-module=/第三方模块源码目录)此处应为
Nginx_Modules_Options=‘--add-module=/root/ngx_http_substitutions_filter_module-master/’
重新编译nginx
./upgrade.sh nginx
四、修改conf文件
server
{
listen 80;
server_name www.baidu.com;
location / {
proxy_pass http://www.modu.pw;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
subs_filter 被替换内容 替换后显示的内容;
}
五、重启nginx
/etc/init.d/nginx restart
