-
-
Save lman/70ee78da3ae1c2461c0429bf847dd08b to your computer and use it in GitHub Desktop.
nginx.conf https only with letsencrypt using lego client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-enabled/example.com.conf | |
server { | |
listen 80; | |
server_name .example.com; | |
location / { | |
return 301 https://$host$request_uri; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name .example.com; | |
ssl_certificate /var/letsencrypt/certificates/example.com.crt; | |
ssl_certificate_key /var/letsencrypt/certificates/example.com.key; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_pass http://internal-content-host; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one time setup | |
$ go get -u github.com/xenolf/lego | |
$ lego --email [email protected] --domains example.com --path /var/letsencrypt --webroot /var/letsencrypt/webcache run | |
# renew (can be run from cron) | |
$ lego --email [email protected] --domains example.com --path /var/letsencrypt --webroot /var/letsencrypt/webcache renew |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment