Using nginx & letsencrypt as SSL proxy

Assuming you have a service running on

http://localhost:8000

and you to want to access it using

https://my.domain.com/

Dowload certbot-auto from

https://certbot.eff.org/docs/install.html

Then, run the following

./certbot-auto certonly --standalone --agree-tos --redirect --duplicate --text --email me@mydomain.com -d my.domain.com --server https://acme-v01.api.letsencrypt.org/directory

Add the following server in your nginx conf file

  listen 443;
  server_name my.domain.com fergalmoran.com;
  ssl_certificate      /etc/letsencrypt/live/my.domain.com/fullchain.pem;
  ssl_certificate_key  /etc/letsencrypt/live/my.domain.com/privkey.pem;

  client_max_body_size 20M;

  location / {
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect off;
  }
}