Securing your website with HTTPS is no longer optional. A valid SSL certificate protects user data, improves search engine rankings, increases customer trust, and removes "Not Secure" warnings from modern browsers.
One of the easiest and most popular ways to enable HTTPS is by using Let's Encrypt, a free Certificate Authority, together with Certbot, an open-source tool that automates SSL certificate installation and renewal.
In this guide, you'll learn how to install a free SSL certificate on Ubuntu servers running Apache or NGINX using Certbot.
Before installing your SSL certificate, make sure you have:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload
Always begin by updating your packages to ensure your server is running the latest security updates.
sudo apt update
sudo apt upgrade -y
Certbot is available directly from Ubuntu's official repositories.
sudo apt install certbot python3-certbot-apache -y
sudo apt install certbot python3-certbot-nginx -y
After installation, verify that Certbot is available.
certbot --version
Once Certbot is installed, request an SSL certificate for your domain.
sudo certbot --apache -d example.com -d www.example.com
sudo certbot --nginx -d example.com -d www.example.com
Replace example.com with your actual domain name.
During installation, Certbot will ask you to:
Selecting automatic HTTP to HTTPS redirection is recommended for most production websites.
After installation completes successfully, open your website using HTTPS.
https://yourdomain.com
You should see a secure padlock icon in your browser.
You can also verify installed certificates using:
sudo certbot certificates
Let's Encrypt SSL certificates are valid for 90 days. Fortunately, Certbot can automatically renew your certificates before they expire, ensuring uninterrupted HTTPS protection.
Check whether the Certbot renewal service is active:
systemctl status certbot.timer
To test the renewal process without making any changes, run a dry run:
sudo certbot renew --dry-run
If the command completes successfully, your server is configured to renew SSL certificates automatically.
Redirecting all visitors from HTTP to HTTPS ensures encrypted communication and helps improve SEO rankings. If you selected automatic redirection during the Certbot installation, this step has already been completed.
If not, update your Apache or NGINX configuration to permanently redirect all HTTP traffic to HTTPS.
HTTP Strict Transport Security (HSTS) instructs browsers to always use HTTPS when accessing your website, preventing protocol downgrade attacks.
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
After updating your configuration, restart your web server.
Verify that your domain's DNS A record points to your server's public IP address before requesting a certificate.
Let's Encrypt validates your domain over HTTP. Make sure port 80 is open in your firewall and cloud security settings.
If renewal fails, test the configuration using the dry-run command and review the Certbot logs located in
/var/log/letsencrypt/.
If your browser still shows "Not Secure," check that your website loads all images, CSS files, JavaScript, and fonts over HTTPS instead of HTTP.
Yes. Let's Encrypt provides SSL certificates at no cost and is trusted by all modern web browsers.
Each certificate is valid for 90 days, but Certbot can renew it automatically before expiration.
Yes. HTTPS is a confirmed Google ranking signal and helps improve user trust, website security, and search engine visibility.
Yes. Certbot officially supports both Apache and NGINX, making SSL installation quick and straightforward.
Absolutely. Certbot supports multiple domains and subdomains by specifying multiple -d parameters when
requesting a certificate.
Installing an SSL certificate is an important step toward building a secure and reliable website. If you need assistance configuring HTTPS, deploying web applications, optimizing Ubuntu servers, or managing Apache and NGINX environments, the experts at Hayatics are here to help.
We specialize in backend development, server administration, cloud deployments, API integrations, DevOps, and AI-powered solutions for businesses of all sizes.
Contact Hayatics today to secure your infrastructure and keep your web applications running safely and efficiently.