NGINX servers use the http_ssl_module module to load SSL certificates. Before you install a certificate on your NGINX server, you must make sure that the server includes the module.
Common errors
Error 1: the "ssl" parameter requires ngx_http_ssl_module
Cause: The NGINX server is not compiled with the http_ssl_module module.
Error 2: nginx: [emerg] unknown directive “ssl” in /usr/local/nginx/conf/nginx.conf
Cause: After you modify the configuration file of the NGINX server and run the nginx -s reload command, if the preceding error appears, the current version of NGINX is not compiled with the http_ssl_module module.
Error 3: ./configure: error: SSL modules require the OpenSSL library
Cause: The OpenSSL dependency library is missing.
Solutions
Check whether OpenSSL is installed on the server. If the NGINX server is not compiled with the http_ssl_module module, recompile the NGINX server to include the http_ssl_module module.
Examples
In this example, an NGINX 1.14.1 server that runs a 64-bit CentOS 8.0 operating system and has OpenSSL 1.1.1k installed is used. This example is for reference only. We recommend that you select a compatible OpenSSL version based on your NGINX version.
Check whether the current NGINX version includes the
http_ssl_modulemodule.Run the following command to check the compilation parameters of NGINX:
nginx -V | grep http_ssl_moduleIf the output includes
--with-http_ssl_module, thehttp_ssl_modulemodule is included. Otherwise, thehttp_ssl_modulemodule is not included, and you must manually install the module.
Install the
http_ssl_modulemodule.# For CentOS, OpenSSL 1.1.1k version. Please choose a compatible OpenSSL version based on your Nginx. sudo yum install openssl-devel-1.1.1kConfigure and compile the
http_ssl_modulemodule.# Go to the Nginx installation directory (example directory, please replace with your actual Nginx installation directory) cd /usr/local/nginx/ # Configure http_ssl_module, other parameters can be customized ./configure --with-http_ssl_module # Compile sudo makeImportantDo not run the make install command. Otherwise, the original NGINX configuration is overwritten.
Check whether the
http_ssl_modulemodule is successfully installed. If not, repeat Steps 2 and 3.nginx -V | grep http_ssl_moduleRestart the NGINX service.
# Go to the executable directory of the Nginx service (example directory, please use the actual path). cd /usr/local/nginx/sbin # Reload the configuration file. ./nginx -s reload