Nginx报错(./configure: error: SSL modules require the OpenSSL library.)

编译Nginx报如下错误:

checking for OpenSSL library ... not found
checking for OpenSSL library in /usr/local/ ... not found
checking for OpenSSL library in /usr/pkg/ ... not found
checking for OpenSSL library in /opt/local/ ... not found
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

其实是OpenSSL的库没有找到。 nginx默认去以下路径查找:/usr/local/ ; /usr/pkg/; /opt/local;

上方所提示使用--with-openssl=来指定openssl的路径,但是其实这里需要指定的是源码包路径,不是openssl的安装位置

可以自行通过该地址https://www.openssl.org/source/openssl-1.1.1d.tar.gz去下载对应的openssl源码包,自行替换相应的openssl版本即可

然后将该包上传至服务器解压,编译nginx时指向该路径即可

./configure --user=nginx  --group=nginx    --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --with-http_ssl_module --with-http_stub
_status_module  --with-http_ssl_module --with-openssl=/opt/nginx/openssl-1.0.2k

  

posted @ 2022-06-01 17:22  RFAA  阅读(4761)  评论(0编辑  收藏  举报