From e2f35dc324280119aeb3d06b005b444bd9e2fe89 Mon Sep 17 00:00:00 2001 From: cleverson Date: Fri, 29 Mar 2024 11:14:09 -0300 Subject: [PATCH] =?UTF-8?q?adi=C3=A7=C3=A3o=20da=20configura=C3=A7=C3=A3o?= =?UTF-8?q?=20do=20ssl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx.conf | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) 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