nginx添加未编译安装模块

从源里安装的module有限,做反向代理的时候重写url需要用到ngx_http_substitutions_filter_module,配置好了,留此备份。


当前环境

➜ ~ uname -a
Linux palytoxin 2.6.32-042stab090.5 #1 SMP Sat Jun 21 00:15:09 MSK 2014 i686 i686 i386 GNU/Linux

检测已有编译选项

which nginx
nginx -V

nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx ...

下载module所需的压缩包

下载对应nginx版本

➜ ~ wget http://nginx.org/download/nginx-1.6.2.tar.gz

重新编译

重新./configure,make编译,不用make install。
千万要注意:到这里就可以了,千万不要make install

./configure  --prefix=/etc/nginx \
             ... 
             --add-module=../ngx_module_xxx

备份nginx

➜ ~ cp /usr/sbin/nginx{,.bak}

停止nginx

➜ ~ service nginx stop

替换nginx

➜ ~nginx cp ./objs/nginx /usr/sbin/nginx

查看下nginx是否编译成功

which nginx
nginx -V

nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx
...
--add-module=../ngx_module_xxx

restart nginx

➜ ~ service nginx restart

done

©palytoxin
@2014

推荐阅读更多精彩内容