Linux nginx Security Certificate SSL Configuration method _nginx

Source: Internet
Author: User
Tags openssl openssl library openssl rsa openssl x509

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.

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.