Skip to content

Instantly share code, notes, and snippets.

@maxtortime
Created November 21, 2017 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtortime/7418649685c7fcb874eebafa5071d60a to your computer and use it in GitHub Desktop.
Save maxtortime/7418649685c7fcb874eebafa5071d60a to your computer and use it in GitHub Desktop.
docker-compose+flask+nginx+certbot nginx configuration
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