Running an unencrypted business website or web application exposes sensitive client data to potential interceptors and damages user trust. Modern web browsers highlight unencrypted HTTP websites as insecure, which negatively affects user engagement and search engine rankings. For Pakistani businesses, startups, and IT administrators, installing an SSL/TLS certificate is a fundamental step in securing server infrastructure.
This tutorial provides a step-by-step guide to installing free, auto-renewing SSL certificates using Certbot and Let's Encrypt on Ubuntu Linux servers running Nginx or Apache web software.
Why SSL/TLS Encryption Matters for Pakistani Business Servers
An SSL (Secure Sockets Layer) or TLS (Transport Layer Security) certificate encrypts the communication channel between your web server and visitor browsers. Without encryption, passwords, form submissions, and customer data travel across public network nodes in plain text.
Implementing valid SSL certificates delivers three essential operational benefits:
- Data Protection: Encrypts login credentials, payment details, and personal information against packet sniffing.
- Brand Credibility: Displays the secure padlock icon in address bars, reassuring Pakistani clients and international customers.
- SEO Performance: Search engines prioritize HTTPS-enabled domains in competitive search rankings.
Prerequisites for Installing Certbot
Before executing command-line installation steps, ensure your Linux server environment meets the following basic setup requirements:
- An active Linux server running Ubuntu 20.04 or 22.04 LTS with non-root sudo access.
- A registered domain name (e.g.,
example.comorexample.pk) configured with an A Record pointing to your server's public IP address. - A running web server package such as Nginx or Apache hosting your functional HTTP website.
Step 1: Installing Certbot and Web Server Plugins
Certbot is the official recommended tool for requesting and renewing Let's Encrypt SSL certificates. The most reliable installation method is using the Snap package manager, which ensures you receive the latest updates directly from the maintainers.
Open your server SSH terminal and update snap core:
sudo snap install core; sudo snap refresh core
If an existing old version of Certbot is installed via apt, remove it first to avoid software version conflicts:
sudo apt-get remove certbot
Next, install the official Certbot package via Snap:
sudo snap install --classic certbot
Create a symbolic link to ensure the certbot command works cleanly across system paths:
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Step 2: Configuring Firewall Access for HTTPS
For Let's Encrypt to verify domain ownership and issue an encryption certificate, your server must accept incoming traffic on port 80 (HTTP) and port 443 (HTTPS). If you are using the Uncomplicated Firewall (UFW) on Ubuntu, you must explicitly grant access.
If you are using Nginx, check existing firewall profiles:
sudo ufw status
Enable the full Nginx profile to allow both standard HTTP and encrypted HTTPS traffic:
sudo ufw allow 'Nginx Full'
If you are running Apache web software instead, execute the following rule:
sudo ufw allow 'Apache Full'
Verify that your firewall settings actively allow ports 80 and 443 before proceeding to the certificate issuance step.
Step 3: Generating and Installing the SSL Certificate
Certbot features automated plugins that automatically detect your web server software, request the certificate from Let's Encrypt, and modify your server config files automatically.
Option A: Automated Setup for Nginx Web Servers
To automatically request an SSL certificate and configure Nginx configuration files, run:
sudo certbot --nginx
Certbot will prompt you for an administrative email address (used for urgent security updates and expiration warnings) and require agreement to the terms of service. Afterward, it reads your Nginx configuration files to identify domain names. Select the domain names you wish to secure by typing their corresponding numbers or leaving the prompt blank to secure all detected hostnames.
Option B: Automated Setup for Apache Web Servers
If your infrastructure runs on Apache, execute the dedicated Apache plugin command:
sudo certbot --apache
The script guides you through identical prompts, generating the certificate keys, updating your virtual host configurations, and setting up an automated HTTP to HTTPS redirect.
Step 4: Verifying Automatic SSL Certificate Renewal
Let's Encrypt certificates remain valid for 90 days. Certbot avoids manual renewal tasks by establishing automated system scripts via background systemd timers or cron tasks. The background script checks twice daily and automatically renews any certificate scheduled to expire within 30 days.
To test whether the renewal automation works without changing live production certificates, run a dry run command:
sudo certbot renew --dry-run
If the terminal returns a success notification, your server is properly configured for perpetual automated SSL management.
Common Troubleshooting Steps and Best Practices
Even with simple automation, initial setup challenges can occur. Keep these best practices in mind when managing web server security:
- Check Domain Propagation: Ensure your domain's DNS records have fully updated to point directly to your server IP. Certbot verification will fail if your DNS records point to an old web host.
- Verify Web Server Block Configurations: Certbot requires valid
server_namedirectives inside Nginx configs orServerNamedirectives in Apache configs. If your config files lack accurate domain declarations, Certbot cannot match incoming requests. - Enforce HTTPS Traffic: Always configure server redirects so that legacy HTTP requests automatically redirect to secure HTTPS connections. Certbot offers to handle this automatically during initial installation.
Frequently Asked Questions (FAQ)
Are Let's Encrypt SSL certificates free for commercial businesses?
Yes. Let's Encrypt is a non-profit Certificate Authority providing valid TLS/SSL certificates at zero charge for both personal and commercial web infrastructure.
How often do I need to renew my SSL certificate manually?
You do not need to renew them manually. Certbot creates a background service (certbot.timer) that automatically handles certificate renewals prior to expiration.
Can I secure multiple domain names on a single Linux server?
Yes, you can include multiple domain names and subdomains in a single Certbot command using the -d flag, such as sudo certbot --nginx -d example.com -d www.example.com.
Professional Server Setup and IT Support by NetBit Tech
Configuring secure server infrastructure requires technical care, robust networking configurations, and ongoing operational maintenance. NetBit Tech provides end-to-end server management, software development, and network cabling solutions tailored for Pakistani offices, educational institutes, and growing commercial enterprises.
Whether you require assistance deploying custom Linux application servers, securing office networks with structured Cat6 and fiber optic backbones, or establishing CCTV security systems in Khuzdar and across Pakistan, netbit software house delivers reliable IT assistance tailored to your requirements.
Ready to upgrade your server infrastructure and security standards? Contact netbit khuzdar today to consult with our certified technical engineers for custom web software deployments, cloud server hardening, and complete office network configurations.
Reader comments.
Share your question, suggestion or experience related to this article.
No comments yet
There are no approved comments on this article yet. You can be the first person to leave one.