nginx添加模块(非覆盖安装)
原已经安装好的nginx,现在需要添加一个未被编译安装的模块:
查看原来编译时都带了哪些参数
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.8.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
configure arguments: --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre
进入nginx源码目录
#cd nginx-1.3.2
添加的参数 (添加之前已经过的编译模块,不然最后只有新编译模块)
#./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-htule --with-pcre --with-http_ssl_module
编译
#make {不要make install,否则就是覆盖安装}
make完之后在objs目录下就多了个nginx,这个就是新版本的程序了
替换nginx二进制文件
#cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
#cp ./objs/nginx /usr/local/nginx/sbin/
测试新的nginx程序是否正确
#/usr/local/nginx/sbin/nginx -t
nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessful
平滑重启nginx
/usr/local/nginx/sbin/nginx -s reload
查看ngixn版本极其编译参数
/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.8.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre --with-http_ssl_module