安装配置ssl模块前执行环境预检测时报错:
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库,一种解决方案:根据提示我们可以根据提示从源代码静态地构建OpenSSL库。
从OpenSSL官网下载OPENSSL,下载地址:https://www.openssl.org/source/。
将资源文件下载上传至服务器/opt/下并解压。
解压完成后,重新使用–with-openssl=参数指定检查配置时使用的openssl库,配置检测:
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-openssl=/otp/openssl-1.1.0k
然后编译安装即可
make && make install
最后,进入nginx源码目录下的objs目录,将’nginx’文件复制到nginx的安装目录sbin下,并执行命令检查是否成功安装ssl模块:
./nginx -V
重启nginx完成!