Last update at :2024-03-22,Edit by888u
LNMP supports applying for free SSL certificates for added site domain names, including BuyPass, ZeroSSL and Let's Encrypt, and then enabling https access for the website. Below, this site (www.vpsgo.com) will share the application for free SSL certificates. Method.
1. Install LNMP environment
The free SSL certificate application method shared in this article is based on LNMP. After version 1.8, the LNMP script integrates three free SSL certificates: BuyPass, ZeroSSL and Let's Encrypt. When we use it to manage the website, we can also add it to the domain name. Apply for an SSL certificate, and LNMP will add an automatic renewal task for the SSL certificate. There is no need to worry about the expiration of the SSL certificate in the future.
If you have not installed LNMP yet, you can install LNMP first according to this tutorial: "One-click installation of LNMP environment on Linux, supporting CentOS/Ubuntu/Debian"
2. LNMP adds SSL certificate to domain name
If you are adding a new site to the host, you can directly choose to apply for an SSL certificate when adding a new site. Related tutorial: "LNMP one-click addition of website: configure domain name + create new MySQL + configure https certificate"
Here we mainly share how LNMP adds SSL certificates to existing sites.
The command is as follows:
lnmp ssl addFollow the prompts and enter the corresponding configuration, including the website directory, whether to enable PHPinfo, whether to add Rewrite rules, etc., and then select the corresponding SSL certificate type. It supports BuyPass, ZeroSSL and Let’s Encrypt, all of which are free:
After all selections are completed, just press Enter to start the application. As shown in the figure below, the SSL certificate application was successful:
3. Configure mandatory https access
LNMP adds automatic renewal of SSL certificates for us, but it does not enable forced jump to https access. We need to manually modify the configuration file and restart Nginx. Take the site of this article as an example.
1. Modify the configuration file
The configuration file is in /usr/local/nginx/conf/vhost. Add the following code to the server listening on port 80:
return 301 https://tm5.vpsgo.com$request_uri;2. Restart Nginx
After that, just restart Nginx. You can refer to: "Organization of Nginx, MySQL and PHP installation directories and configuration file paths in LNMP"
Recommended site search: server abroad, website IP address query dual line dual IP, rent server, IP purchase, what is the server, registration-free virtual host, virtual host Hong Kong host, Alibaba Cloud domain name registration entrance, cloud host,
p>
发表评论