From 86a44afd19430da9df2a93d8632fa67237eab250 Mon Sep 17 00:00:00 2001 From: Moritz Date: Sun, 7 Sep 2025 11:27:17 +0200 Subject: [PATCH] fix nginx --- nginx.conf.tmpl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/nginx.conf.tmpl b/nginx.conf.tmpl index db5514b..4169fc4 100644 --- a/nginx.conf.tmpl +++ b/nginx.conf.tmpl @@ -5,6 +5,16 @@ events { } http { + + resolver 127.0.0.11 valid=30s ipv6=off; + resolver_timeout 5s; + + upstream matrix_upstream { + zone matrix_upstream 64k; + server {{ env "STACK_NAME"}}_app:8008 resolve; + keepalive 16; + } + server { listen 80; @@ -14,7 +24,7 @@ http { server_name {{ env "DOMAIN" }}; location = / { - proxy_pass http://{{ env "STACK_NAME"}}_app:8008; + proxy_pass http://matrix_upstream; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $host; @@ -23,7 +33,7 @@ http { } location ~* ^(\/_matrix|\/_synapse\/client) { - proxy_pass http://{{ env "STACK_NAME"}}_app:8008; + proxy_pass http://matrix_upstream; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $host; @@ -42,7 +52,7 @@ http { if ($http_referer !~ "^https://{{ env "DOMAIN" }}/admin/") { return 403; } - proxy_pass http://{{ env "STACK_NAME"}}_app:8008; + proxy_pass http://matrix_upstream; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $host;