nginx 编译安装1.17.3版本,添加openssl参数报错问题解决
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,背景最近在升级nginx1.14.1到nginx1.17.3版本时,发现了一个openssl的报错,记录一下问题的发生以及解决过程,供大家参考。问题升级nginx时,我按照惯例,使用原版本的编译参数,
千家信息网最后更新 2025年12月02日nginx 编译安装1.17.3版本,添加openssl参数报错问题解决
背景
最近在升级nginx1.14.1到nginx1.17.3版本时,发现了一个openssl的报错,记录一下问题的发生以及解决过程,供大家参考。
问题
升级nginx时,我按照惯例,使用原版本的编译参数,来进行1.17.3新版本的编译,如下:
# /usr/local/nginx/sbin/nginx -V取得编译参数:--prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_dav_module --with-http_realip_module --with-http_gzip_static_module --with-http_v2_module
利用旧版本的编译参数来编译新版本nginx,make的时候,发现出现了错误,操作与信息如下:
# tar -zxvf nginx-1.17.3.tar.gz# cd nginx-1.17.3# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_dav_module --with-http_realip_module --with-http_gzip_static_module --with-http_v2_module# makemake -f objs/Makefilemake[1]: Entering directory `/root/soft/nginx-1.17.3'cd /usr/local/openssl \&& if [ -f Makefile ]; then make clean; fi \&& ./config --prefix=/usr/local/openssl/.openssl no-shared no-threads \&& make \&& make install_sw LIBDIR=lib/bin/sh: line 2: ./config: No such file or directorymake[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] Error 127make[1]: Leaving directory `
从报错信息上看,可以看到编译是openssl相关的组件报错了,可能是"--with-openssl=/usr/local/openssl" 这个参数导致。这里提到了"/usr/local/openssl/.openssl/include/openssl/ssl.h"这个文件,我尝试去找这个文件,发现文件找不到:(/usr/local/openssl是我自己安装的openssl)
# ll /usr/local/openssl/.openssl/ls: cannot access /usr/local/openssl/.openssl/: No such file or directory
可以发现.openssl这个目录本身是不存在的,应该是nginx 1.17.3版本编译的时候默认去找了"/usr/local/openssl/.openssl/"这个目录,所以导致了make失败。
解决
发现了问题可能的原因后,尝试修改一下nginx1.17.3添加openssl模块时候的相关编译信息(auto/lib/openssl/conf):
# vi auto/lib/openssl/conf CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include" CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" //在该文件中,看到openssl的core相关目录,都被添加上了.openssl这级目录,尝试修改目录信息,去除.openssl这级目录: # more auto/lib/open/ssl CORE_INCS="$CORE_INCS $OPENSSL/include" CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h" CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a" CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
修改完auto/lib/openssl/conf的信息之后,重新编译安装nginx1.17.3,即可正常编译安装成功。
# make clean# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_dav_module --with-http_realip_module --with-http_gzip_static_module --with-http_v2_module# make && make install
编译
目录
信息
参数
版本
文件
问题
时候
尝试
升级
成功
原因
惯例
模块
组件
背景
过程
错误
参考
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
精睿.网络安全
安全生产管家服务器配置是多少
暑期网络安全小报
物流系统软件开发报告
特定无线网络技术
上海巡检软件开发解决方案
神武4微信公众号找不到服务器
建造服务化是在互联网科技
数据库应用模式中
深化改革网络安全
自定义炒股软件开发
哪些国家网络安全计划
情侣服务器名字
asp 在线编辑服务器
南通东翔网络技术有限公司
数据库用户账号管理
网络安全具体指
如何让服务器显示坐标
喜欢网络安全的人
自己做服务器需要学会什么语言
免费ip数据库接口
数据库删除后恢复
网络安全研究所待遇怎么样
2020国家网络安全周宣传
浙江冠状病毒最新数据库
理想汽车软件开发面试
重庆妙享网络技术股份
存储过程是数据库对象
多部门联合网络安全执法
顺平软件开发系统