Securing NGINX with Let’s Encrypt on Ubuntu 22.04 involves obtaining an SSL/TLS certificate from Let’s Encrypt and configuring NGINX to use this certificate for HTTPS encryption. Here’s a step-by-step guide:
Before you begin, make sure you have the following:
Now, let’s secure NGINX with Let’s Encrypt:
```bash sudo apt update ```
```bash sudo apt install certbot python3-certbot-nginx ```
```bash sudo certbot --nginx -d your_domain ```
Certbot will interactively ask you for information and configure NGINX to use the obtained certificate.
Certbot will automatically set up a cron job to renew your certificate when it’s close to expiration. Certificates provided by Let’s Encrypt are usually valid for 90 days, so this automatic renewal process is essential to keep your website secure.
You can verify that the automatic renewal process works by running the following command:
```bash sudo certbot renew --dry-run ```
If there are no errors, the renewal process is working correctly.
Visit your website using HTTPS (e.g., `https://your_domain`). You should see a secure padlock icon in your browser’s address bar, indicating that your site is now using HTTPS.
By default, Certbot will create a server block for your domain in `/etc/nginx/sites-available/your_domain`. You can customize this configuration as needed, such as adding additional security headers or configuring specific SSL settings.
It’s a good practice to verify your SSL/TLS configuration using an online tool like SSL Labs. Enter your domain and check the rating and details of your SSL certificate setup.
Congratulations! You’ve successfully secured NGINX with Let’s Encrypt on Ubuntu 22.04. Your website is now accessible over HTTPS with a valid SSL/TLS certificate.
Have additional questions? Search below: