1. Download the Let’s Encrypt Client
First, download the Let’s Encrypt client, certbot
.
As mentioned just above, we tested the instructions on Ubuntu 16.04, and these are the appropriate commands on that platform:
$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python-certbot-nginx
With Ubuntu 18.04 and later, substitute the Python 3 version:
$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python3-certbot-nginx
2. Set Up NGINX
certbot
can automatically configure NGINX for SSL/TLS. It looks for and modifies the server
block in your NGINX configuration that contains a server_name
directive with the domain name you’re requesting a certificate for. In our example, the domain is www.example.com.
- Assuming you’re starting with a fresh NGINX install, use a text editor to create a file in the /etc/nginx/conf.d directory named domain‑name.conf (so in our example, www.example.com.conf).
- Specify your domain name (and variants, if any) with the
server_name
directive:server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; server_name example.com www.example.com; }
- Save the file, then run this command to verify the syntax of your configuration and restart NGINX:
$ nginx -t && nginx -s reload
3. Obtain the SSL/TLS Certificate
The NGINX plug‑in for certbot
takes care of reconfiguring NGINX and reloading its configuration whenever necessary.
- Run the following command to generate certificates with the NGINX plug‑in:
$ sudo certbot --nginx -d example.com -d www.example.com
- Respond to prompts from
certbot
to configure your HTTPS settings, which involves entering your email address and agreeing to the Let’s Encrypt terms of service.
If you look at domain‑name.conf, you see that certbot
has modified it:
server { listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name example.com www.example.com;
listen 443 ssl; # managed by Certbot
# RSA certificate
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# Redirect non-https traffic to https
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
4. Automatically Renew Let’s Encrypt Certificates
Let’s Encrypt certificates expire after 90 days. We encourage you to renew your certificates automatically. Here we add a cron
job to an existing crontab file to do this.
- Open the crontab file.
$ crontab -e
- Add the
certbot
command to run daily. In this example, we run the command every day at noon. The command checks to see if the certificate on the server will expire within the next 30 days, and renews it if so. The--quiet
directive tellscertbot
not to generate output.0 12 * * * /usr/bin/certbot renew --quiet
- Save and close the file. All installed certificates will be automatically renewed and reloaded.
-
vivo T3 Pro 5G (Emerald Green, 128 GB) (8 GB RAM)Original price was: ₹29,999.00.₹24,999.00Current price is: ₹24,999.00.
-
boAt Airdopes 141 Bluetooth TWS in Ear Earbuds with 42H Playtime,Low Latency Mode for Gaming, ENx Tech, IWP, IPX4 Water Resistance, Smooth Touch Controls(Olive Green)Original price was: ₹4,490.00.₹1,299.00Current price is: ₹1,299.00.
-
Apple iPhone 16 (256 GB) – BlackOriginal price was: ₹89,900.00.₹89,000.00Current price is: ₹89,000.00.
-
Redmi 13C 5G (Startrail Silver, 4GB RAM, 128GB Storage) | MediaTek Dimensity 6100+ 5G | 90Hz DisplayOriginal price was: ₹13,999.00.₹10,499.00Current price is: ₹10,499.00.
-
Apple 20W USB-C Power Adapter (for iPhone, iPad & AirPods)Original price was: ₹1,900.00.₹1,549.00Current price is: ₹1,549.00.
-
Redmi 13C (Starfrost White, 4GB RAM, 128GB Storage) | Powered by 4G MediaTek Helio G85 | 90Hz Display | 50MP AI Triple CameraOriginal price was: ₹11,999.00.₹7,698.00Current price is: ₹7,698.00.
-
One Article PostOriginal price was: ₹2,000.00.₹1,000.00Current price is: ₹1,000.00.
-
Standard PlanOriginal price was: ₹40,000.00.₹29,988.30Current price is: ₹29,988.30.
-
Search Engine Optimization(SEO)Original price was: ₹7,000.00.₹4,999.00Current price is: ₹4,999.00.
Discover more from Soa Technology | Aditya Website Development Designing Company
Subscribe to get the latest posts sent to your email.