How to Deploy NGINX on Ubuntu 24.04 with Let’s Encrypt SSL in 4 Easy Steps

Introduction:
Deploying a secure NGINX web server on Ubuntu 24.04 is simple. Follow these steps to set up NGINX with a free SSL certificate from Let’s Encrypt.

Step 1: Update Your Server
Before starting, ensure your server is up to date. Run the following commands to update your package list and upgrade your installed packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install NGINX
Once the system is updated, install NGINX:

sudo apt install nginx -y

After installation, start and enable NGINX to run at boot:

sudo systemctl start nginx && sudo systemctl enable nginx

You can verify that NGINX is running by visiting your server’s IP address in a browser.

Step 3: Install Certbot and Obtain an SSL Certificate
Now, install Certbot and the NGINX plugin to automate the SSL certificate installation:

sudo apt install certbot python3-certbot-nginx -y

Next, obtain the SSL certificate for your domain:

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Follow the prompts to agree to the terms of service and select whether to redirect HTTP to HTTPS (choose ‘redirect’ to force HTTPS).

Step 4: Set Up Automatic Certificate Renewal
Let’s Encrypt certificates expire every 90 days. To ensure your SSL certificate renews automatically, set up a cron job:

sudo systemctl enable certbot.timer

This command ensures Certbot will automatically check and renew the certificate before expiration.

Done!
Congratulations! You’ve successfully deployed NGINX with a Let’s Encrypt SSL certificate on Ubuntu 24.04. Your server is now secure and ready for traffic. Regular updates and SSL certificate renewals will keep your web server safe and stable.

How Can We Help?

Disclaimer

Please note that the views, thoughts, and opinions expressed in this article belong solely to the author, and not necessarily to the author’s employer, organization, committee or other group or individual.

While the author has made every effort to ensure that the information in this article was correct at the time of publication, the author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause. Always conduct your own due diligence before making any decisions based on the information provided in this article.

Like this article?

Facebook
Twitter
LinkedIn
Reddit
Email