nginx 编译安装1.17.3版本,添加openssl参数报错问题解决
发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,背景最近在升级nginx1.14.1到nginx1.17.3版本时,发现了一个openssl的报错,记录一下问题的发生以及解决过程,供大家参考。问题升级nginx时,我按照惯例,使用原版本的编译参数,
千家信息网最后更新 2026年11月03日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安全错误
数据库的锁怎样保障安全
互联网科技公司排名
上海卓越科技互联网
科技与互联网
互联网和科技创新
互联网通讯科技
智能科技公司是互联网公司吗
关于新基建和互联网科技
期待互联网科技
奇酷互联网科技公司
卓越科技(互联网 )
华中科技大学互联网
互联网科技公司有哪些
亿人帮互联网科技
互联网科技汛
山东吉时兔互联网科技有限公司
海南科技产业互联网平台
锡山区互联网智能科技产品供应
伍佰万互联网科技怎么赚钱
重庆科技产业互联网有哪些
中国主要互联网科技公司
保险科技 互联网保险
广州万易互联网科技有限公司
互联网科技工作委员会
融贸通互联网科技
互联网科技公司做什么
广西拼得多互联网科技有限公司
深圳艾果互联网通讯科技
互联网科技实习生岗位
上海乐五互联网科技有限公司
萌小萌互联网科技河南有限公司