Nginx upgrade under Linux

 

The nginx version upgrade will not overwrite the configuration file, but just in case, please back up the configuration file or configuration folder before upgrading

Default configuration file address: /usr/local/nginx/conf/nginx.conf

  

1. Download

wget -c http://nginx.org/download/nginx-1.24.0.tar.gz

 

2. Unzip

tar -xvf nginx-1.24.0.tar.gz

 3. nginx configuration compilation

//进入新版本目录
cd nginx-1.24.0
//执行配置
./configure
//执行编译(只编译不安装)
make

 Note:
If the historical version nginx path is not the default path, you need to add the corresponding parameter in ./configure, the default is /usr/local/nginx.

./configure --prefix=/home/software/nginx

4. Backup historical version, set new version, check new version

//备份旧版本文件
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
//复制新版本文件
cp nginx-1.22.0/objs/nginx /usr/local/nginx/sbin/
//测试新版本nginx配置是否正常
cd nginx/sbin
./nginx -t
//验证nginx是否升级成功
./nginx -V

 

 5. Close the historical version nginx

//关掉nginx所有进程
killall nginx

 6. Start the new version of nginx and check that nginx is running

//重启nginx
./nginx
//检查新版本运行
ps -ef|grep nginx

 

 

Guess you like

Origin blog.csdn.net/mao_mao37/article/details/131698283