ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

编译nginx时openssl报错的解决方案

2020-05-16 14:51:19  阅读:2718  来源: 互联网

标签:local openssl nginx 报错 usr ngx event


出现提示错误openssl版本错误

src/event/ngx_event_openssl.c: In function ‘ngx_ssl_dhparam’:
src/event/ngx_event_openssl.c:954:11: error: dereferencing pointer to incomplete type ‘DH’ {aka ‘struct dh_st’}
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function ‘ngx_ssl_connection_error’:
src/event/ngx_event_openssl.c:1941:21: error: ‘SSL_R_NO_CIPHERS_PASSED’ undeclared (first use in this function); did you mean ‘SSL_R_NO_CIPHERS_SPECIFIED’?
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
SSL_R_NO_CIPHERS_SPECIFIED
src/event/ngx_event_openssl.c:1941:21: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [objs/Makefile:816: objs/src/event/ngx_event_openssl.o] Error 1
make[1]: Leaving directory '/root/nginx-1.10.1'
make: *** [Makefile:8: build] Error 2

分析原因:由于yum默认使用了openssl 1.1.x 版本,导致的API不一致引起的

解决:

直接安装openssl1.0版本
wget http://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar -zxvf openssl-1.1.0e.tar.gz
cd openssl-1.1.0e/ &&./config shared zlib --prefix=/usr/local/openssl && make && make install 进入目录把openssl编译安装到 /usr/local/openssl 下
./config -t
make depend
//一种度makefile的规则,通过扫描仪个目录下的所有C\C++ 代码,从而判专断出文件之间的依赖关系,如a.cc文件中调用了b.h(如以形势include<b.h>),如果之后a.cc文件被改动,那 么只需要重新编属译a.cc文件,不需要编译b.h文件。否则所有的文件都需要重新编译。

cd /usr/local
ln -s openssl ssl
echo "/usr/local/openssl/lib" >>/etc/ld.so.conf
ldconfig
echo "PATH=$PATH:/usr/local/openssl/bin" >> /etc/profile && source /etc/profile

好嘞,查看版本 ,OK

我们再次进入nginx下

./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.39 --with-zlib=../zlib-1.2.8 --with-openssl=../opensll-1.1.0e

注意这里还是要把objs/Makefile下的werror去掉

然后启动一下nginx

/usr/local/nginx/sbin/nginx

查看一下进程和端口是否开启

看看chrome能不能打开nginx的网页

OK

标签:local,openssl,nginx,报错,usr,ngx,event
来源: https://www.cnblogs.com/hxlinux/p/12900495.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有