环境:CentOS 7 旧 Nginx:1.17.9 升级版本:1.19.5

  • 下载最新版 Nginx(1.19.5)
    wget https://nginx.org/download/nginx-1.19.5.tar.gz
  • 停止 nginx (由于博主是小站可以停业务,如果业务不能停可尝试平滑升级)
    systemctl stop nginx
  • 编译 Nginx
    nginx -V    // 查看 Nginx 编译参数
    tar xvf nginx-1.19.5.tar.gz    // 解压Nginx
    cd nginx-1.19.5    // 切换目录

    // 编译新的 nginx
    .configuer    --prefix=/usr/local/nginx \
    --without-http_memcached_module \
    --user=www \
    --group=www \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-http_gzip_static_module \
    --with-openssl=/usr/local/src/openssl-1.1.1g \
    --with-zlib=/usr/local/src/zlib-1.2.11 \
    --with-pcre=/usr/local/src/pcre-8.44
    
    make        // 只能用 make,千万不要敲 make install,敲了就覆盖了
  • 替换 nginx 二进制文件
    cp /usr/local/nginx/sbin/nginx /root/        // 结合自己的软件目录
    cp objs/nginx /usr/local/nginx/sbin            // 请结合自己的实际目录,objs 是源码目录
    nginx -t    // 测试nginx
    systemctl start nginx    // 启动 nginx
    nginx -v    // 查看运行的 nginx 版本是否正确

「 希望熬过一切,星光璀璨 」

流年小站,感谢有您的支持

「 道路坎坷,感谢有您 ---来自 anYun 的感谢 」

使用微信扫描二维码完成支付

2020-12-12
已阅:17157 人/次

 
 
 
分享是一种美德 x
打开微信,右上角的"+"选择"扫一扫"
使用“扫一扫”将博文分享至朋友圈吧

本文由 anYun 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。
我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3oibnoh9lo6cs

还不快抢沙发

添加新评论

Myssl安全认证