Using nginx & letsencrypt as SSL proxy

Assuming you have a service running on


and you to want to access it using

Dowload certbot-auto from

Then, run the following

./certbot-auto certonly --standalone --agree-tos --redirect --duplicate --text --email -d --server

Add the following server in your nginx conf file

  listen 443;
  ssl_certificate      /etc/letsencrypt/live/;
  ssl_certificate_key  /etc/letsencrypt/live/;

  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_redirect off;