Share how I am configuring SSL on the Nginx step by step.
First, make sure that the OpenSSL library is installed and that the –with-http_ssl_module parameters are used when installing Nginx.
Beginners or novices recommend using LNMP for one-click installation.
To generate a certificate:
Enter the directory where you want to generate the certificate
Cd/usr/local/nginx/conf
Use OpenSSL to create the server private key, enter information about the appropriate prompts
Copy Code code as follows:
OpenSSL genrsa-des3-out Server.key 1024
Create a Certificate signing request (certificate signing request (CSR))
Copy Code code as follows:
OpenSSL Req-new-key server.key-out SERVER.CSR
Prompt must enter key when Nginx is started on SSL
Copy Code code as follows:
CP Server.key server.key.org
OpenSSL rsa-in server.key.org-out Server.key
Signing a certificate using the private key and the CSR that you just generated
Copy Code code as follows:
OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt
Configuration Description:
Adding in the server
Copy Code code as follows:
SSL on;
SSL_CERTIFICATE/USR/LOCAL/NGINX/CONF/SERVER.CRT;
Ssl_certificate_key/usr/local/nginx/conf/server.key;
Set the listen port to 443 and start the test.