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

相关推荐
YXXY3137 小时前
线程的介绍(四)
linux
Snasph8 小时前
GNU Make 用户手册(中文版)
服务器·算法·gnu
广州灵眸科技有限公司8 小时前
瑞芯微RV1126B开发板(EASY-EAI-PI2) Easy-Eai编译环境准备与更新
服务器·前端·人工智能·python·深度学习
Esaka_Forever8 小时前
uv init 完整用法(Python 最快包管理器)
服务器·python·uv
溜达的大象9 小时前
服务器挂了等用户报障?我用Prometheus搭了一套监控告警,服务器出状况第一时间通知我
服务器·php·prometheus
kTR2hD1qb9 小时前
从 Responses API 到 Chat Completions:一个模型网关的设计复盘
linux·前端
姓刘的哦10 小时前
大模型祛魅
linux
闪电悠米11 小时前
黑马点评-Redisson-01_why_redisson
java·服务器·网络·数据库·缓存·wpf
hj28625111 小时前
linux下一步学习内容
linux·运维
tudoSearcher12 小时前
日志、指标、链路追踪:可观测性三支柱深度解析
运维·服务器·网络·prometheus