Next, after installing Nginx, enable HTTPS
1. Open https://freessl.org,
Fill in your domain name in the input box to create a free certificate
Enter your email address as required, then click on "Generate"
Login domain name management platform Add resolution record, record type TXT, host record selected TXT record, record value corresponding record value.
Then wait 2 minutes after the point verification. Or, after you add DNS resolution, you can click manually to verify
It then generates a certificate file and a private key file that can be downloaded
These two files are what we want to use.
Vim/etc/nginx/nginx.conf, enable the following option to add the certificate path.
/usr/sbin/nginx–t Check the Nginx configuration file, no problem, you can restart Nginx
Systemctl Restart Nginx.service
You can then use HTTPS to access your website,
If you want to make HTTP jump to HTTPS, add a line of code to the location
Rewrite ^ (. *) https://$server _name$1 permanent;
The egg (not filed)
Nginx Enable HTTPS