Compiling Nginx reports the following error:
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.
In fact, the OpenSSL library was not found. By default, nginx looks in the following paths: /usr/local/ ; /usr/pkg/; /opt/local;
The above prompt uses --with-openssl=
to specify the path of openssl
, but in fact, you need to specify the path of the source package, not the installation location of openssl
.
You can download the corresponding openssl
source package through this address https://www.openssl.org/source/openssl-1.1.1d.tar.gz
, and replace the corresponding openssl
version by yourself.
Then upload the package to the server to decompress it, and point to this path when compiling 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