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

相关推荐
s_little_monster8 分钟前
【Linux】网络--数据链路层--以太网
linux·运维·网络·经验分享·笔记·学习·计算机网络
Adorable老犀牛1 小时前
负载均衡将https请求转发后端http服务报错:The plain HTTP request was sent to HTTPS port
nginx·http·https·负载均衡
lil44x_1 小时前
嵌入式学习笔记DAY33(网络编程——TCP)
服务器·笔记·学习
belldeep3 小时前
WSL 安装 Debian 12 后,Linux 如何安装 curl , quickjs ?
linux·运维·debian·curl·quickjs
%#RulER#%5 小时前
哈工大计算机系统2024大作业——Hello的程序人生
linux·笔记·程序人生
y1x2y35 小时前
【HITCSAPP 哈工大计算机系统期末大作业】 程序人生-Hello’s P2P
linux·程序人生·ubuntu
God_archer5 小时前
程序人生-hello’s P2P
linux·c语言·汇编·程序人生
西域曼波王5 小时前
哈尔滨工业大学计算机系统大作业程序人生-Hello’s P2P
linux·c语言·编辑器·vim
无效的名字6 小时前
如何安装并使用RustDesk
linux·运维·服务器
Amo Xiang8 小时前
Python 解释器安装全攻略(适用于 Linux / Windows / macOS)
linux·windows·python·环境安装