Focus on cloud service provider activities
Notes on website operation and maintenance

LNMP One Key Package Environment Installing SSL Security Certificates and Deploying HTTPS Website URL Process

Generally, when we log in and visit shopping and membership websites, we will see that the URL in the address bar is slightly different from our ordinary website visits. In particular, at the front of the URL address bar, we will see signs in green or even other colors. This is what we call the HTTPS address, which uses SSL security certificate encryption. Encrypt the transmission of user information under certain circumstances.

At the end of last year, Google announced that it would give a certain weight to websites with SSL certificates, but there is no such statement in domestic search engines. However, when we visited Baidu, we also saw that the official website also enabled HTTPS addresses. Lao Zuo believes that no matter what kind of weight points are added to the website, if our website is in the form of member interaction, especially for the transmission of personal information, it is still necessary to add SSL certificates to such websites.

For the acquisition of SSL certificates, if we want to learn how to apply for STARTSSL or Votone free SSL, please refer to“ Free Wotong digital certificate SSL application process Chinese interface issuing certificate fast And The whole process of StartSSL application enables the website to have a free SSL certificate "This article applies for free SSL deployment learning. If we need to use a formal website, we recommend purchasing a paid SSL certificate.

In this article, Jiang will share how we can install SSL on LNMP One Button Package (military brother) and deploy our site to be accessed through HTTPS.

Step 1. Preparation for basic HTTPS deployment

A - We need to use the LNMP one click package to install in our existing VPS environment. If you do not install it or are unclear about it, you can refer to“ Basic Tutorial Directory of LNMP One click Installation Package "Article.

B - Lao Zuo here uses Votone free SSL as a demonstration, so I have applied for free SSL, and we can see that there are various environments in the certificate file after decompression.

 Basic work preparation for HTTPS deployment

Because we use the NGINX WEB environment here, we need to decompress FOR NGINX ZIP file package, and then see a CRT and a KEY file.

Step 2: Upload and deploy SSL certificates

A - Upload the above CRT and KEY files to the VPS ROOT directory, and then modify them to SSL accordingly CRT and SSL KEY file name, or we can use it as other commands.

B - Decrypt private key and set permissions

openssl rsa -in ssl.key -out /root/ssl.key
chmod 600 /root/ssl.key

Log in to SSH and execute the above two lines of script to decrypt the private key and authorization.

Step 3. Deploy site SSL settings in the LNMP environment

We need to add a site to the existing LNMP, and then set the CONF file corresponding to the site.

In the "/usr/local/nginx/conf/vhost/" directory file, find the conf file of the corresponding site, and then modify the settings as follows

listen 80;
 listen 443 ssl;
#listen [::]:80;
ssl on;
        ssl_certificate /root/ssl.crt;
        ssl_certificate_key /root/ssl.key;

The part marked in red above is added by me. The corresponding path should correspond to the path and file name of the CRT and KEY files uploaded before.

Finally, when we restart LNMP, we can see that the SSL certificate takes effect and HTTPS can access the site.


If we need to force the use of HTTPS website access, we need to remove the listen 80; script.

In conclusion, through the above steps, we can basically complete the deployment of HTTPS site URLs. For those that need to optimize the environment to improve efficiency, Lao Zuo will learn later and share them.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( one )
Do not reprint without permission: Lao Zuo's Notes » LNMP One Key Package Environment Installing SSL Security Certificates and Deploying HTTPS Website URL Process

Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge