Nginx configuration SSL becomes a simple HTTPS server

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.