Created
November 21, 2017 13:43
-
-
Save maxtortime/7418649685c7fcb874eebafa5071d60a to your computer and use it in GitHub Desktop.
docker-compose+flask+nginx+certbot nginx configuration
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
events { | |
} | |
http { | |
upstream certbot_upstream{ | |
server certbot:80; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
return 301 https://exmaple.com$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name example.com www.example.com; | |
charset utf-8; | |
ssl on; | |
ssl_certificate /certs/fullchain.pem; | |
ssl_certificate_key /certs/privkey.pem; | |
location /static { | |
alias /code/app/static; | |
} | |
location / { | |
proxy_pass http://web:8000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
} | |
location /.well-known/acme-challenge { | |
default_type "text/plain"; | |
proxy_pass http://certbot_upstream; | |
} | |
include /etc/nginx/mime.types; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment