To set up SSL on your Ubuntu 22.04 server, you can use Let’s Encrypt, a free SSL certificate provider. Here’s a step-by-step guide on how to do it:
Step 1: Install Nginx (if not already installed)
Make sure you have Nginx installed. If not, follow these steps:
Step 2: Install Certbot and Nginx Plugin
Certbot is the recommended tool for obtaining and renewing Let’s Encrypt SSL certificates.
- Add the Certbot repository and install the required packages:
Step 3: Obtain an SSL Certificate
- Ensure that your domain is correctly pointed to your server’s IP address.
- Run Certbot to automatically configure SSL with Nginx:
Replace
yourdomain.com
with your actual domain name. - Certbot will ask you to provide an email address and agree to the terms of service. After that, it will automatically configure SSL for your Nginx server.
Step 4: Verify SSL Installation
After the process is complete, you should see a success message. Certbot will automatically reload Nginx, and SSL will be active.
To verify the SSL installation, open your website in a browser using https://
. You should see the padlock icon next to the URL, indicating a secure connection.
Alternatively, you can use tools like SSL Labs’ SSL Test to check the configuration.
Step 5: Set Up Auto-Renewal
Let’s Encrypt certificates are valid for 90 days, so you need to set up auto-renewal to ensure your SSL certificate doesn’t expire.
- Certbot automatically sets up a cron job for auto-renewal, but you can test it manually to make sure it works:
If the test passes, Certbot will renew your certificates automatically.
Step 6: Force HTTPS (Optional)
To ensure your visitors always access your site over HTTPS, you can configure Nginx to redirect HTTP to HTTPS.
- Open your Nginx configuration file for your site:
- Add the following configuration inside the
server
block to force the redirect: - Save and close the file. Then, test and reload Nginx:
Step 7: Check and Test SSL
- Visit your website using
https://
and confirm that the padlock icon appears in the browser’s address bar, indicating a secure connection. - You can also check your SSL certificate using online tools like SSL Labs’ SSL Test.
Now, your site should be securely running on HTTPS with a free SSL certificate from Let’s Encrypt. Let me know if you need further assistance!
Download Now No episodes found.Posted in Ubuntu