Nginx Letsencrypt

This is still work in progress

Install Nginx and Certbot

Install Nginx and Certbot

sudo apt update
sudo apt install nginx python3-certbot-nginx

Create a folder for your site. Replace with your domain

sudo mkdir -p /var/www/
sudo nano /var/www/
<!doctype html>
    <h1>Hello World</h1>

Create a config file for your site.

sudo nano /etc/nginx/sites-available/

Put this into the file above. Replace with your domain

server {
       listen 80;
       listen [::]:80;


       root /var/www/;
       index index.html;

       location / {
               try_files $uri $uri/ =404;

Enable your site.

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled

Check your config is correct

sudo nginx -t

Reload Nginx

sudo systemctl reload nginx

Set up Letsencrypt

sudo certbot --nginx -d