-
Aug16
-
已经安装LNMP的朋友依然可以使用
apt-get -y install subversion #安装SVN
svn checkout http://substitutions4nginx.googlecode.com/svn/trunk/ substitutions4nginx-read-only
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --add-module=/root/substitutions4nginx-read-only --with-http_gzip_static_module --with-ipv6
主要就是在LNMP的基础上添加红色字体的模块
完成后重启NGINX
/etc/init.d/nginx restart
配置代理和过滤
server
{
listen 80;
server_name www.wyangel.com; #绑定的域名
root /home/wwwroot; #网站目录(搭配lnmp的时候有用处!)
access_log off; #off 关闭日志
location / {
subs_filter 'www.ideaplat.com' 'www.wyangel.com' gi; #substitutions4nginx替换 (使用方法参照官方)
subs_filter '思想空间' '无忧天使网' gi; #substitutions4nginx替换 (使用方法参照官方)
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer http://www.ideaplat.com; #强制定义Referer,程序验证判断会用到
proxy_set_header Host www.ideaplat.com; #定义主机头,如果目标站点绑定的域名个server_name项的吻合则使用$host
proxy_pass http://114.17.19.17; #指定目标,建议使用IP或者nginx自定义池
proxy_set_header Accept-Encoding ""; #清除编码
}
}