From 62c6b8357dfbc18c969af55eb9bb11450d5ab793 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Fri, 10 Jan 2025 05:53:03 -0500 Subject: [PATCH] chore: make proxy.conf to a template --- .env.example | 2 ++ compose.yml | 3 ++- proxy.conf | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 7c767a3..d7ddcb6 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ PORT=3000 HOST="0.0.0.0" + +PROXY_DOMAIN="localhost" diff --git a/compose.yml b/compose.yml index 0661d14..d2125b2 100644 --- a/compose.yml +++ b/compose.yml @@ -13,5 +13,6 @@ services: ports: - 80:80 volumes: - - ./proxy.conf:/etc/nginx/conf.d/proxy.conf + - ./proxy.conf:/etc/nginx/conf.d/proxy.conf.template network_mode: host + command: /bin/sh -c "sed 's/{PROXY_DOMAIN}/$PROXY_DOMAIN/' /etc/nginx/conf.d/proxy.conf.template > /etc/nginx/conf.d/proxy.conf && nginx -g 'daemon off;'" diff --git a/proxy.conf b/proxy.conf index 90929ad..0e40932 100644 --- a/proxy.conf +++ b/proxy.conf @@ -2,7 +2,7 @@ server { listen 80; listen [::]:80; - server_name localhost; + server_name {PROXY_DOMAIN}; location / { proxy_pass http://127.0.0.1:3000; @@ -13,7 +13,7 @@ server { listen 80; listen [::]:80; - server_name "~^(port-(?.*)\.)?(?.*)\.localhost"; + server_name "~^(port-(?.*)\.)?(?.*)\.{PROXY_DOMAIN}"; location / { if ($port = "") {