查询ngnix之前编译安装参数
/usr/local/nginx/sbin/nginx -V
进入nginx源码目录重新编译
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error.log \
--pid-path=/usr/local/nginx/logs/nginx.pid \
--with-http_ssl_module \
--with-openssl=/app/software/openssl-OpenSSL_1_0_2k \
--add-module=/app/software/echo-nginx-module-0.61 \
--add-module=/app/software/fastdfs-nginx-module-master/src \
--add-module=/app/software/ngx_cache_purge-2.3
openssl和echo为我新加的模块可以从开源网站下载
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2k.tar.gz # 下载openssl
tar -xzvf OpenSSL_1_0_2k.tar.gz # 解压openssl
wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz
tar -xzvf v0.61.tar.gz
然后执行make,千万别make install,否则就覆盖安装了
make完成之后再obj目录下就会多出来一个nginx,这就是最新的安装程序
备份之前nginx的安装程序
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
把新的nginx版本覆盖旧的版本
cp objs/nginx /usr/local/nginx/sbin/nginx
测试是否可用
/usr/local/nginx/sbin/nginx -t
ngx_http_fastdfs_set pid=91430
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
查看安装模块:/usr/local/nginx/sbin/nginx -V
重启nginx
/usr/local/nginx/sbin/nginx -s reload
来源:oschina
链接:https://my.oschina.net/javazyw/blog/3167108