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

Nginx/Apache deploy NameCheap SSL certificate to implement HTTPS address method

Subsequent“ Namecheap SSL certificate (PositiveSSL) activation and Nginx environment SSL acquisition "In the article, Lao Zuo has shared how to activate and install PositiveSSL purchased cheaply on Black Friday. Although the HTTPS address is not very good for Chinese environment support now, it will be a trend in the future, so technical learning and sorting can be reserved.

Because the previous article had limited time and energy, it was not recorded together, so we took some time to deploy the obtained SSL certificate to the website during the New Year's Day holiday. A little different from the Voton SSL certificate is that Nginx and Apache environments share a common set of certificate files, so we can deploy the certificate file obtained from Namecheap to Nginx and Apache website environments.

 Get NAMECHEAP SSL Certificate KEY

The above is the certificate file we obtained from the Namecheap official. It is different from the one used by NC family. The certificate file has been merged into two files. Those who have played before should know that four files need to be merged by ourselves. It is much simpler now.

First, deployment Namecheap SSL Certificate preparation

Whether we deploy the SSL certificate to the Nginx environment or the Apache environment, we should at least copy the laozuo.csr and laozuo.key files generated in the server to the local.

Secondly, we also need to decompress the compressed package file downloaded from NC. We need to decompress both files and put them together with the above two files. Although not all of them need to be used, they are somehow backed up together. When they are used later, they are uploaded to the specified directory. Here we have our own names laozuo_org.ca-bundle, laozuo_org.crt, and we define the names ourselves, Don't name them randomly because they are afraid of confusion.

Second, deploying SSL in the Nginx environment

1. Upload the laozuo.key and laozuo_org.crt files to the/usr/local/nginx/conf/directory.

2. Configure the. conf file

/usr/local/nginx/conf/vhost/

In the above directory, we need to configure the. conf file of the SSL certificate site to modify the configuration

 Deploy SSL in Nginx environment

In the configuration file, we can see that the annotation part is added by me, and then the update file can take effect after restarting NGINX, and all the original HTTP addresses are redirected to HTTPS addresses. Of course, this is just a simple configuration. Lao Zuo has seen many tutorials and many parameters that can be set, such as the cache time. This will be studied later. If there is a friend, you can give advice.

3. Restart nginx to take effect

Third, deploy SSL certificates in the Apache environment

Reading previous blog articles, Lao Zuo has“ LAMP (Apache) environment deployment, installation of SSL security certificate and HTTPS encryption of website "It was written in that the method of deploying SSL certificates in the Apache environment is somewhat similar. In this environment, Lao Zuo is in the Apache 2.2 environment, and version 2.4 may be different.

1. Ensure SSL module deployment

yum install openssl
yum install mod_ssl

No matter whether it is deployed to our environment or not, we will re deploy it ourselves.

2. Check and start the SSL module

In our environment, it is the ssl.conf file in the/etc/httpd/conf.d/directory, which Lao Zuo opened with the Submlme editor.

Check the LoadModule ssl_module modules/mod_ssl.so line, and then if you see a # in front of it, start it. If it has been removed, leave it alone.

3. Edit Deployment SSL

Similarly, in the ssl.conf file, edit the lines below the<VirtualHost _default_: 443>location

DocumentRoot "/var/www/laozuo.org/public_html/"
ServerName laozuo.org:443
SSLEngine on
SSLCertificateFile /root/laozuo.org.crt
SSLCertificateKeyFile /root/laozuo.key
SSLCertificateChainFile /root/laozuo_root_bundle.crt

What should be noted here is that the three file paths that need to be uploaded will be used wherever we upload them.

4. Restart Apache

service httpd restart

Fourth Namecheap SSL Certificate Deployment Summary

Whether we use a paid SSL certificate or a free SSL certificate, the general process is similar. Just deploy the obtained certificate file to the corresponding path of the corresponding environment to connect. Of course, there are some details. The amount of information is messy. Later, Laozuo uses a practical site to test.

For example, some cache time and some parameters are not very clear, and they are not added in the above deployment. Later, we will use an actual website to see the corresponding effect. If a friend is skilled in using HTTPS, he can inform or contact Lao Zuo. Lao Zuo hopes to ask a few questions.

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( two )
Do not reprint without permission: Lao Zuo's Notes » Nginx/Apache deploy NameCheap SSL certificate to implement HTTPS address method


Scan the code to follow the official account

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