原已经安装好的nginx,现在需要添加一个未被编译安装的模块:

nginx -V 可以查看原来编译时都带了哪些参数

原来的参数:
--prefix=/appliaction/nginx1

添加的参数:
--with-http_stub_status_module

步骤如下:
1. 使用参数重新配置:
./configure --prefix=/application/nginx1 --user=root --group=root --with-http_realip_module --with-http_sub_module --with-http_flv_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_addition_module --with-http_ssl_module

2.
make
#不要make install,否则就是覆盖安装
3. 替换nginx二进制文件:
cp /application/nginx1/sbin/nginx /application/nginx1/sbin/nginx.bak  ##备份原来nginx文件
cp ./objs/nginx /app/nginx/sbin/   ##objs 文件夹在nginx安装源上,如果无法COPY 需要停止服务后再COPY

 ps -ef | grep nginx

kill TERM 主进程号

4. 启动nginx

    application/nginx1/sbin nginx