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.
- One Server
- One Domain
- You've completed part one or have an existing nginx configuration
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
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