1.下载需要的文件
# cd ~ # git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
2.查看之前Nginx编译configure
# nginx -V nginx version: nginx/1.2.7 built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with- http_ssl_module --with-http_gzip_static_module --with-ipv6
3.重新编译Nginx
# cd ~/lnmp1.1-full/ # vim upgrade_nginx.sh # 大概在配置文件的line 90左右,重新configure # 添加--with-http_sub_module --add-module=/root/ngx_http_substitutions_filter_module # ./configure --prefix= --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --add-module=/root/ngx_http_substitutions_filter_module
4.修改Nginx配置文件并重启
# /etc/init.d/nginx -t # 提示没有错误的话可以执行重启 # /etc/init.d/nginx restart # 或者执行以下两步 # /etc/init.d/nginx stop # /etc/init.d/nginx startvia Chu's Space http://bit.ly/1pPmSeV