diff --git a/nginx.conf b/nginx.conf index 2525be1..0fa6c32 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,19 +1,39 @@ events {} http { - access_log on; - sendfile on; - + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + server { listen 80; - server_name localhost; - + listen [::]:80; + + server_name $DOMAIN www.$DOMAIN; + location / { - proxy_pass http://app:5000; + proxy_pass http://$FLASK_SERVER_ADDR; 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; } } -} + + server { + listen [::]:443 ssl http2; + listen 443 ssl http2; + server_name $DOMAIN www.$DOMAIN; + + ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem; + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto https; + proxy_pass http://$FLASK_SERVER_ADDR; + } + + } +} \ No newline at end of file