nginx平滑升级及nginx配置文件
文章目录
nginx平滑升级并添加新功能
1.先获取老版本的编译信息
2.获取新版本安装包和功能包
3.配置新版本或功能,配置时加上老版本的编译参数,然后添加新功能模块
4.进行编译,编译完不进行安装操作
5.备份老版本程序,使用复制的方法。在停掉老版本程序的进程,将新版本程序复制到老版本所在位置直接替换掉老版本程序并启动新版本程序
//查看老版本编译信息
[root@nginx ~]# nginx -V
nginx version: nginx/1.20.2
built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
built with OpenSSL 1.1.1k FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-debug --with-http_ssl_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module
//准备好新版本安装包和功能包
[root@nginx ~]# wget http://nginx.org/download/nginx-1.22.0.tar.gz
[root@nginx ~]# yum -y install git
[root@nginx ~]# git clone https://gitee.com/Their-own/nginx_module_echo.git
[root@nginx ~]# ls
anaconda-ks.cfg nginx-1.20.2 nginx-1.20.2.tar.gz nginx-1.22.0 nginx-1.22.0.tar.gz nginx_module_echo
//解压并编译
[root@nginx ~]# tar xf nginx-1.22.0.tar.gz
[root@nginx ~]# cd nginx-1.22.0
[root@nginx nginx-1.22.0]# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-debug \
--with-http_ssl_module \
--with<