Nginx升级

linux下nginx升级

# 查看原程序的编译参数
cd /usr/local/nginx
./sbin/nginx -V
# configure arguments:后的参数就是编译参数

cd /usr/local
# 备份
mkdir nginx-bak
cp -rf nginx/* nginx-bak/
# 下载
wget http://nginx.org/download/nginx-1.14.1.tar.gz
tar xzf nginx-1.14.1.tar.gz
cd nginx-1.14.1
./configure --prefix=/usr/local/nginx
make      # 注意只make  不要make install
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d)
cp objs/nginx /usr/local/nginx/sbin/      # 复制编译make后的文件覆盖nginx原文件
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`  # 使旧版nginx停止就收请求,新版nginx接替
./nginx -t
./nginx -s reload

参考
https://www.cnblogs.com/chenwz/p/7622983.html
https://www.aliyun.com/jiaocheng/118734.html

你可能感兴趣的:(IT人生)