From 994e99e7d0228dd4744b8378fff0842e7ed1169a Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Mon, 15 Jan 2024 21:44:07 +0800 Subject: [PATCH] fix: optional services --- nginx/nginx.conf | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 6db9c6342..043135274 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -7,7 +7,7 @@ events { http { # docker dns resolver - resolver 127.0.0.11 valid=30s; + resolver 127.0.0.11 valid=10s; map $http_upgrade $connection_upgrade { default upgrade; @@ -36,8 +36,8 @@ http { # GoTrue location /gotrue/ { - set $backend "http://gotrue:9999"; - proxy_pass $backend; + set $gotrue gotrue; + proxy_pass http://$gotrue:9999; rewrite ^/gotrue(/.*)$ $1 break; @@ -49,8 +49,8 @@ http { # WebSocket location /ws { - set $backend "http://appflowy_cloud:8000"; - proxy_pass $backend; + set $appflowy_cloud appflowy_cloud; + proxy_pass http://$appflowy_cloud:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -61,8 +61,8 @@ http { # AppFlowy-Cloud location /api { - set $backend "http://appflowy_cloud:8000"; - proxy_pass $backend; + set $appflowy_cloud appflowy_cloud; + proxy_pass http://$appflowy_cloud:8000; proxy_set_header X-Request-Id $request_id; } @@ -71,6 +71,9 @@ http { # Derive from: https://min.io/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html # Optional Module, comment this section if you are did not deploy minio in docker-compose.yml location /minio/ { + set $minio minio; + proxy_pass http://$minio:9001; + rewrite ^/minio/(.*) /$1 break; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; @@ -92,16 +95,13 @@ http { # proxy_set_header Origin ''; chunked_transfer_encoding off; - - set $backend "http://minio:9001"; - proxy_pass $backend; } # PgAdmin # Optional Module, comment this section if you are did not deploy pgadmin in docker-compose.yml location /pgadmin/ { - set $backend "http://pgadmin:80/"; - proxy_pass $backend; + set $pgadmin pgadmin; + proxy_pass http://$pgadmin:80; proxy_set_header X-Script-Name /pgadmin; proxy_set_header X-Scheme $scheme; @@ -112,18 +112,20 @@ http { # Portainer # Optional Module, comment this section if you are did not deploy portainer in docker-compose.yml location /portainer/ { - set $backend "http://portainer:9000/"; - proxy_pass $backend; + set $portainer portainer; + proxy_pass http://$portainer:9000; + + rewrite ^/portainer/(.*) /$1 break; } # Admin Frontend # Optional Module, comment this section if you are did not deploy admin_frontend in docker-compose.yml location / { + set $admin_frontend admin_frontend; + proxy_pass http://$admin_frontend:3000; + proxy_set_header X-Scheme $scheme; proxy_set_header Host $host; - - set $backend "http://admin_frontend:3000"; - proxy_pass $backend; } }