Purchase server and domain name, domain name record


Apply for an SSL certificate

Cloud.tencent.com/product/ssl…

Screenshots:








Validation is a. Well-known/pKI-validation /fileauth. TXT file that you want to create in the root directory of your domain name.

If you haven’t checked after a few minutes, check to see if your website is accessible or if you have read permissions on your files.

Configure an SSL certificate for the server (using Nginx as an example)

If the server does not have the SSL module installed, you will need to install it first. If it is installed, skip this step.

Installation part:

Get the original configuration parameters:

    nginx -V
Copy the code



Go to the original installation package and add — with-http_SSL_module (mine already exists) to the end of the obtained configuration parameters:

 ./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi --with-http_ssl_module
Copy the code

Do not make install, or the existing compiled files will be overwritten.

/usr/local/nginx = /usr/local/nginx = /usr/local/nginx

    cd /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
Copy the code

My source package is /downloads/nginx-1.12.2 (remember to stop the nginx service).

Cp/downloads/nginx - 1.12.2 / objs/nginx/usr /local/nginx/sbin/nginx
Copy the code

Note that if you copy the nginx in /usr/local/bin or /usr/bin, you need to replace the nginx as well.

Configuration part:

         

This is my configuration, and the circled parts need to be added on the original basis. Ssl_certificate and SSL_certificate_key fill in the certificate key address applied by Tencent Cloud (upload it to the server locally by yourself).

           

At this point, the configuration is complete, and then restart Nginx to make HTTPS requests.