Installing SSL Certificates for NGINX
SSL is essential for any modern website. It protects visitor traffic, enables HTTPS, improves trust, and avoids browser security warnings. On Ubuntu, the most common way to install free SSL certificates for NGINX is using Certbot with Let’s Encrypt.
Step 1: Make sure your domain points to the server IP address. SSL validation will fail if DNS is wrong.
Step 2: Install Certbot and the NGINX plugin:
sudo apt update sudo apt install certbot python3-certbot-nginx -y
Step 3: Run Certbot:
sudo certbot —nginx
Certbot will scan your NGINX server blocks and ask which domain you want to secure. Select the correct domain and choose the redirect option if you want all HTTP traffic redirected to HTTPS.
Step 4: Test NGINX after the certificate is installed:
sudo nginx -t
Step 5: Reload NGINX if needed:
sudo systemctl reload nginx
Step 6: Check renewal:
sudo certbot renew —dry-run
Useful certificate commands:
sudo certbot certificates sudo certbot renew sudo systemctl status certbot.timer
If SSL fails, check three things first: DNS records, firewall rules, and whether NGINX is reachable on port 80. Let’s Encrypt needs to verify the domain before issuing the certificate. If port 80 is blocked, validation may fail.
For hosting customers, a good SSL setup should redirect HTTP to HTTPS, use the correct domain names, and renew automatically. Never edit live SSL files randomly unless you know why. A small mistake can stop the website from loading securely.