原环境:
# /usr/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.1.1c 28 May 2019
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-http_ssl_module --with-openssl=/usr/local/ssl --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --add-module=/opt/nginx/ngx_devel_kit-0.3.1 --add-module=/opt/nginx/lua-nginx-module-0.10.15 --add-module=/opt/nginx/nginx_upstream_check_module-master
# cat /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /opt/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
安装包下载:
http://nginx.org/download/nginx-1.20.1.tar.gz
安装nginx1.20.1过程:
cp /opt/nginx/conf/nginx.conf{,.bak}
tar -zxf nginx-1.20.1.tar.gz
cd nginx-1.20.1
cp auto/lib/openssl/conf{,.bak}
vim auto/lib/openssl/conf
:39,42s@/.openssl@@g修改去掉.openssl/
# CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
# CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
# CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
# CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
# CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
改为:
CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIB

本文介绍了如何将Nginx 1.16版本升级到1.20版本,提供了两种方法:一是直接make upgrade,二是通过逐步停机替换二进制文件并重启。详细步骤包括备份配置、更改编译选项、执行升级和验证新版本。
最低0.47元/天 解锁文章
6413

被折叠的 条评论
为什么被折叠?



