Nginx 升级到 nginx-1.20.1

升级注意保留历史版本这样可以及时切换,将新版本的编译在新的文件夹中
1、下载nginx 版本
wget http://nginx.org/download/nginx-1.20.1.tar.gz
2、移动到 /usr/local
mv nginx-1.20.1.tar.gz /usr/local/
cd /usr/local/
3、解压
tar xzf nginx-1.20.1.tar.gz
4、切换到root 权限,通过root权限进行编译
sudo -i
cd nginx-1.20.1
5、编译
./configure --prefix=/usr/local/nginx1.20/ && make && make install && echo Ok.
6、如果缺少模块重新编译
./configure --prefix=/usr/local/nginx1.20/ --with-http_stub_status_module --with-http_ssl_module && make && make install && echo Ok.
7、校验配置文件,并启动
/usr/local/nginx1.20/sbin/nginx -t -c /etc/nginx/nginx.conf
/usr/local/nginx1.20/sbin/nginx -c /etc/nginx/nginx.conf

如果yum 安装模块,没有外网注意修改yum 源

/etc/yum.conf
或
/etc/yum.repos.d/

文件内容
#proxy=http://xxxx

如果下载没有外网设置代理

export https_proxy=https://xxxx
export http_proxy=http://xxxx

遇到问题 ,最新版本的nginx需要使用最新版本openssl

在这里插入图片描述

cd /usr/local/src/

# 下载最新的openssl
sudo wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz

sudo tar zxfv openssl-1.1.1k.tar.gz

# 重新编译并指定  --with-openssl=/usr/local/src/openssl-1.1.1k

cd /usr/local/nginx-1.20.1/

./configure --prefix=/usr/local/nginx1.20/ --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.1.1k && make && make install && echo Ok.

如下:编译成功

......
test -f '/usr/local/nginx1.20//conf/nginx.conf' \
        || cp conf/nginx.conf '/usr/local/nginx1.20//conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx1.20//conf/nginx.conf.default'
test -d '/usr/local/nginx1.20//logs' \
        || mkdir -p '/usr/local/nginx1.20//logs'
test -d '/usr/local/nginx1.20//logs' \
        || mkdir -p '/usr/local/nginx1.20//logs'
test -d '/usr/local/nginx1.20//html' \
        || cp -R html '/usr/local/nginx1.20/'
test -d '/usr/local/nginx1.20//logs' \
        || mkdir -p '/usr/local/nginx1.20//logs'
make[1]: Leaving directory `/usr/local/nginx-1.20.1'
Ok.
  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值