Nginx: Part II - Set up automatic and free SSL via Let's Encrypt (Ubuntu 18.04)

Now that we have a web server set up, it's probably a good idea to encrypt our traffic with SSL (and a requirement for some applications).

Make sure to read part one as well, to learn how to set up multiple (sub-)domains with one server.

Prerequisites

  • One Server
  • One Domain
  • You've completed part one or have an existing nginx configuration

Installing Dependencies

First we need to install certbot, which will automatically set up and renew our SSL certificates.

sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx

Configure Certbot

After certbot is installed, we can run it's configuration command.

sudo certbot --rsa-key-size 4096 --nginx

This will ask you for your email and which domains you want to configure. You need to enter your email to get notified when something goes wrong.

Finally, we can reload nginx to apply our configuration.

sudo systemctl reload nginx
Show Comments