Execute the following command under any path (for example,/opt/nginx/crt/) to generate a certificate and key:
OpenSSL genrsa-des3-out Openssl.key 1024
OpenSSL req-new-x509-key openssl.key-out openssl.crt-days 3650
OpenSSL rsa-in openssl.key-out Openssl_nopass.key
Generated Certificate: OPENSSL.CRT
Key:openssl_nopass.key of certificates
Edit nginx.conf
Release a comment from the HTTPS server and modify:
Ssl_certificate, Ssl_certificate_key is the path to the certificate and key that you just generated:
SSL_CERTIFICATE/OPT/NGINX/CRT/OPENSSL.CRT;
Ssl_certificate_key/opt/nginx/crt/openssl_nopass.key;
Start Nginx, Access HTTPS port (default 443)
Example of HTTPS-related configuration in nginx.conf:
server {
Listen 443 SSL;
server_name Xubuntu;
SSL_CERTIFICATE/OPT/NGINX/CRT/OPENSSL.CRT;
Ssl_certificate_key/opt/nginx/crt/openssl_nopass.key;
Ssl_session_cache shared:ssl:1m;
Ssl_session_timeout 10m;
Ssl_ciphers high:!anull:! MD5;
Ssl_prefer_server_ciphers on;
Location/{
root HTML;
Index index.html index.htm;
}
}
Nginx configuration SSL becomes a simple HTTPS server