统信UnionTech OS Server 20 Enterprise 升级Nginx 版本升级步骤
1. 关闭旧版本 Nginx
/usr/local/nginx/sbin/nginx -s stop
2. 下载 Nginx 安装包
- 官方下载地址:https://nginx.org/download/
- 下载版本:
nginx-1.29.1.tar.gz
3. 上传包与解压
- 将下载的安装包上传到服务器
- 解压文件:
tar -zxvf nginx-1.29.1.tar.gz
4. 进入安装目录
cd nginx-1.29.1
5. 配置安装参数
./configure --prefix=/usr/local/nginx-1.29 --with-http_stub_status_module --with-http_ssl_module
说明:
--prefix=/usr/local/nginx表示安装后的所有文件会被放在/usr/local/nginx-1.29目录中
遇到的错误及解决方式
- 错误信息:
./configure: error: SSL modules require the OpenSSL library. - 解决方式:
sudo apt-get install openssl libssl-dev
6. 编译并安装
make && make install
7. 备份配置文件和代码
# 备份配置文件
cp -r /usr/local/nginx-1.29/conf/nginx.conf /usr/local/nginx-1.29/conf/nginx.conf.bak
# 备份html目录
cp -r /usr/local/nginx-1.29/html /usr/local/nginx-1.29/html.bak
8. 迁移旧版本配置
# 复制旧版本配置文件到新版本
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx-1.29/conf/nginx.conf
# 复制旧版本html目录到新版本
cp -r /usr/local/nginx/html /usr/local/nginx-1.29/html
9. 启动新版本 Nginx
/usr/local/nginx-1.29/sbin/nginx
1820

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



