How to setup Nginx with Let’s Encrypt in Ubuntu?

To set up Let’s Encrypt with Nginx on Ubuntu, follow these steps:

  1. Install Certbot and its Nginx plugin by running the following commands:
  1. Adjust your firewall to allow HTTPS traffic. You can either add the Nginx HTTPS profile or use Nginx Full and delete the existing Nginx HTTP rule:

Verify that you added a rule allowing HTTPS traffic by using the ufw status command.

  1. Obtain an SSL certificate by running the following command, replacing yourdomain.com and www.yourdomain.com with your domain names:

Certbot will ask you some question like this:

The Nginx plugin for Certbot will reconfigure Nginx and reload its configuration when necessary.

Read more here: Source link