Skip to content
  • Home
  • Services
    • Combo Plans
      • Shared Support
      • Semi Dedicated Support
      • Dedicated Support
    • Control Panel Support
      • DirectAdmin Support
      • cPanel Support
      • Plesk Support
    • Server Setup & Support
  • Products
    • Managed Migration
    • Nginx Support
    • Varnish Support
    • Shield
  • Careers
    • Internship Programme
  • KnowledgeBase
  • Contact Us
  • Blog
  • About Us

WHM-cPanel Control Panel

4
  • How to log in to cPanel?
  • How to find outdated services in cPanel
  • Exclude services from the outdated services script’s check in cPanel
  • catch-all accounts, and how to add that in cPanel

Email

3
  • How to install mail function on a Centos server.
  • SPF, DKIM, and DMARC records explained
  • How to configure an Email account manually on the Thunderbird client

SSL certificates

3
  • How to install SSL on nginx with Let’s Encrypt
  • SSL installation and renewal on an Nginx server
  • Installation of SSL in Haproxy and HTTP to HTTPS Redirection

Webservers

1
  • Enable GZIP compression in Nginx

Security

1
  • Disabling mail alerts from LFD

News

46
  • White House report on Open-source AI models
  • Linux Kernel 6.9 – End of Life
  • Verify if SystemD or not on Linux
  • SLUBStick: A Groundbreaking Kernel Exploitation Technique
  • Top 5 Linux Distros for Every User Level
  • Alpaca: The Open-Source AI Model for Linux Enthusiasts
  • Zero-Day Threat: The Risks of the IP Address Exploit
  • Intel Engineer Boosts Linux Kernel Boot Time by 0.035 Seconds
  • Canonical’s New Aggressive Kernel Policy: Ubuntu Releases
  • KDE Frameworks 6.5 Released: What’s New?
  • Ubuntu 24.10 to Feature the Latest Linux Kernel
  • Linux 6.11-rc3 Released: Performance Boosts and Key Fixes
  • The Open Model Initiative Joins the Linux Foundation
  • New Study Debunks Fears of AI Threats
  • AI-Powered Screenshot Search for Pixel 9 Devices
  • Fastfetch: A High-Performance Alternative to Neofetch
  • Containers: Efficient OS-Level Virtualization & Top Tools
  • Tails 6.6-Enhanced Security, Anonymity,Decentralized Features
  • Kubernetes 1.31 “Elli” Release: New Features and Updates
  • Unleashing the Power of Arch Linux with Archinstall 2.8.2
  • Deepin 23 Released with Atomic Updates and Broad CPU Support
  • Secure Your Linux Systems with Expert Cybersecurity
  • NGINX Fixes Buffer Overread Vulnerability (CVE-2024-7347)
  • Linux Kernel Flaw Lets Attackers Bypass CPU and Write to Memory
  • 0.0.0.0 Day Vulnerability:18-Year-Old Browser Flaw
  • CachyOS August 2024: Open NVIDIA Modules & COSMIC Desktop
  • Windows Update Breaks Linux Boot on Dual-Boot Systems
  • EasyOS 6.2 Released: Lightweight Linux Distro-New Features
  • Upstreaming Linux Kernel Support for Raspberry Pi 5
  • Canonical Pauses Ubuntu Kernel Updates Until October 2024
  • 9 Years of LVFS: Transforming Linux Firmware Updates
  • Record Bounty Awarded for LiteSpeed Cache Vulnerability
  • Red Hat OpenShift Lightspeed: AI Assistant for OpenShift
  • Linux 6.12 Introduces QR Code in DRM Panic Handler
  • Rust for Linux Maintainer Resigns Amid ‘Nontechnical Nonsense’
  • Ubuntu 24.10 to Feature Latest Linux 6.11 Kernel
  • LinkedIn Migrates from CentOS to Azure Linux
  • Linux 6.11-rc5 Released with Streamlined Bcachefs Fixes
  • AMD Preferred Core Fix Arrives Before Linux 6.11-rc6
  • Debian 12.7 Released: 55 Security Updates, 51 Bug Fixes
  • 4MLinux 46 Released: New Apps, LAMP Server Included
  • Cicada3301 Ransomware Targets VMware ESXi Systems
  • Advanced Linux Persistence Techniques: Elastic Security’s Insights
  • Sedexp Malware Evades Detection for Two Years on Linux
  • Minimal Linux Runs on Raspberry Pi’s RP2350 Microcontroller
  • Manage Linux User Activity with Acct/Psacct

Operating System

1
  • CentOS 7 End-of-Life: What You Need to Know and How to Migrate
  • Home
  • KnowledgeBase
  • SSL certificates
  • How to install SSL on nginx with Let’s Encrypt
View Categories

How to install SSL on nginx with Let’s Encrypt

1 min read

SSL Let's Encrypt logo


This article explains How to install SSL on nginx with Let’s Encrypt.

1. Download the Let’s Encrypt Client #

First, download the Let’s Encrypt client, certbot.

As mentioned just above, we tested the instructions on Ubuntu 16.04, and these are the appropriate commands on that platform:

With Ubuntu 18.04 and later, substitute the Python 3 version:

$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python3-certbot-nginx

2. Set Up NGINX #

certbot can automatically configure NGINX for SSL/TLS. It looks for and modifies the server block in your NGINX configuration that contains a server_name directive with the domain name you’re requesting a certificate for. In our example, the domain is www.example.com.

  1. Assuming you’re starting with a fresh NGINX install, use a text editor to create a file in the /etc/nginx/conf.d directory named domain‑name.conf (so in our example, www.example.com.conf).
  2. Specify your domain name (and variants, if any) with the server_name directive:
    pdat
server
{ 
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name example.com www.example.com;
}

3. Save the file, then run this command to verify the syntax of your configuration and restart NGINX:

 $ nginx -t && nginx -s reload

3. Obtain the SSL/TLS Certificate #

The NGINX plug‑in for certbot takes care of reconfiguring NGINX and reloading its configuration whenever necessary.

  1. Run the following command to generate certificates with the NGINX plug‑in:
$ sudo certbot --nginx -d example.com -d www.example.com

2. Respond to prompts from certbot to configure your HTTPS settings, which involves entering your email address and agreeing to the Let’s Encrypt terms of service.

    If you look at domain‑name.conf, you see that certbot has modified it:

    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;
        server_name  example.com www.example.com;
    
        listen 443 ssl; # managed by Certbot
    
        # RSA certificate
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    
        # Redirect non-https traffic to https
        if ($scheme != "https") {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    }

    4. Automatically Renew Let’s Encrypt Certificates #

    Let’s Encrypt certificates expire after 90 days. We encourage you to renew your certificates automatically. Here we add a cron job to an existing crontab file to do this.

    1. Open the crontab file.
     $ crontab -e



    2. Add the certbot command to run daily. In this example, we run the command every day at noon. The command checks to see if the certificate on the server will expire within the next 30 days and renews it if so. The –quiet directive tells certbot not to generate output.

    0 12 * * * /usr/bin/certbot renew --quiet

    3. Save and close the file. All installed certificates will be automatically renewed and reloaded.

    Now, you learned how to install SSL on nginx with Let’s Encrypt.

    Share This Article :
    • Facebook
    • X
    • LinkedIn
    • Pinterest
    Still stuck? How can we help?

    How can we help?

    Updated on June 17, 2023

    Powered by BetterDocs

    Table of Contents
    • 1. Download the Let’s Encrypt Client
    • 2. Set Up NGINX
    • 3. Obtain the SSL/TLS Certificate
    • 4. Automatically Renew Let’s Encrypt Certificates

    The last technical support you will ever need!

    select one of our plans and start building the most wanted app/website available today. We make sure every aspect of the server maintenance are handled with  a level of expertise needed for growing your business!

    Copyright 2024 techprovidence