1. Install NGINX
apt-get install nginx
Done! Just kidding.
2. Get Certbot if you want to use LetsEncrypt
sudo snap install --classic certbot
3. Set up NGINX
sudo curl https://ssl-config.mozilla.org/ffdhe2048.txt > /etc/ssl/ffdhe4096.pem
sudo ufw allow 'Nginx Full'
Then update settings:
> sudo nano /etc/nginx/nginx.conf
worker_connections 1024;
server_tokens off;
4. Create certificates (optional)
Create certificates BEFORE setting up NGINX config for the project with the following (remove --dry-run):
sudo certbot certonly --domains example.com --nginx --dry-run
sudo certbot renew --dry-run
Don’t forget that www also needs a separate certificate.
5. Start service
systemctl enable nginx