Last active
September 24, 2018 07:26
-
-
Save marcelino-m/06a2387d4fba7ad6ab56704d1c8e32d7 to your computer and use it in GitHub Desktop.
Example of a nginx conf using Let's Encrypt
This file contains 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
# Virtual Host configuration for myorg.cl | |
# | |
# You can move that to a different file under sites-available/ and symlink that | |
# to sites-enabled/ to enable it. | |
# | |
server { | |
listen 80; | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/myhost.myorg.cl/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/myhost.myorg.cl/privkey.pem; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
add_header Strict-Transport-Security "max-age=31536000"; | |
server_name myhost.myorg.cl; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
if ($scheme = http) { | |
return 301 https://$server_name$request_uri; | |
} | |
location /.well-known { | |
alias /var/www/html/captor/.well-known; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:8081; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put this in
/etc/nginx/snippets/letsencrypt.conf
fileand then in your example (without the proxy settings that is another snippet)...