nginx与openSSL版本不兼容问题

本人先前使用的nginx-version为1.18.0,openSSL-version为3.0.2;

在源码的安装configure过程中,出现以下报错

复制代码
error: 'ENGINE_free' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  734 |             ENGINE_free(engine);
      |             ^~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:22,
                 from src/core/ngx_core.h:84,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/engine.h:493:27: note: declared here
  493 | OSSL_DEPRECATEDIN_3_0 int ENGINE_free(ENGINE *e);
      |                           ^~~~~~~~~~~
src/event/ngx_event_openssl.c:738:9: error: 'ENGINE_free' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  738 |         ENGINE_free(engine);
      |         ^~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:22,
                 from src/core/ngx_core.h:84,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/engine.h:493:27: note: declared here

查阅资料得知nginx1.18.0与openSSL 3.0不兼容,我将nginx升级到1.22.0-version解决了此问题。

安装步骤

1. 更新系统包

首先,更新系统包以确保所有软件都是最新版本:

复制代码
sudo apt-get update
sudo apt-get upgrade -y

2. 安装编译工具和依赖

安装编译 Nginx 所需的工具和库:

复制代码
sudo apt-get install -y build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev

3. 下载并编译 Nginx

3.1下载 Nginx 源码

复制代码
mkdir ~/nginx-build && cd ~/nginx-build
wget http://nginx.org/download/nginx-1.22.0.tar.gz 
tar -zxvf nginx-1.22.0.tar.gz

3.2编译 Nginx 并添加想要安装的模块,例如RTMP 模块

复制代码
cd nginx-1.22.0
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module
make
sudo make install

4.启动nginx

复制代码
sudo /usr/local/nginx/sbin/nginx

5.验证配置

5.1检查 Nginx 是否运行

复制代码
sudo /usr/local/nginx/sbin/nginx -t

5.2检查 RTMP 模块是否加载

复制代码
sudo /usr/local/nginx/sbin/nginx -V

如果配置正确,你应该在输出中看到 --add-module=...nginx-rtmp-module

相关推荐
云霄IT几秒前
centos7安装防火墙为项目开放服务器端口
服务器·网络·windows
草莓熊Lotso几秒前
Linux 2.6 内核 O(1) 调度队列深度解析:为什么它能实现常数时间调度?
linux·运维·服务器·数据结构·人工智能·哈希算法·散列表
不染尘.8 分钟前
Linux的基本管理及命令(上)
linux·windows·ssh
全栈小59 分钟前
【PHP】如何将ThinkPHP 5部署到windows服务器的IIS里,和PHP版本又是一个怎么样的关系,三分钟教程搞定部署
服务器·windows·php
米高梅狮子12 分钟前
12. SELinux 加固 Linux 安全
linux·运维·安全
weixin_4624462312 分钟前
【原创实践】Windows 和 Linux 下使用 Python 3.10 搭建 PaddleOCRVL 识别图片并100%还原表格
linux·windows·python·飞浆
人工智能训练1 小时前
UE5中如何解决角色网格体“掉下去”的问题
运维·服务器·windows·容器·ue5
Sumlll_8 小时前
Ubuntu系统下QEMU的安装与RISC-V的测试
linux·ubuntu·risc-v
猫头虎9 小时前
2025最新OpenEuler系统安装MySQL的详细教程
linux·服务器·数据库·sql·mysql·macos·openeuler
木子.李3479 小时前
ssh连接远程服务器相关总结
运维·服务器·ssh