chore: make proxy.conf to a template

This commit is contained in:
CyberL1 2025-01-10 05:53:03 -05:00
parent a84091983c
commit 62c6b8357d
3 changed files with 6 additions and 3 deletions

View File

@ -1,2 +1,4 @@
PORT=3000 PORT=3000
HOST="0.0.0.0" HOST="0.0.0.0"
PROXY_DOMAIN="localhost"

View File

@ -13,5 +13,6 @@ services:
ports: ports:
- 80:80 - 80:80
volumes: volumes:
- ./proxy.conf:/etc/nginx/conf.d/proxy.conf - ./proxy.conf:/etc/nginx/conf.d/proxy.conf.template
network_mode: host 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;'"

View File

@ -2,7 +2,7 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name localhost; server_name {PROXY_DOMAIN};
location / { location / {
proxy_pass http://127.0.0.1:3000; proxy_pass http://127.0.0.1:3000;
@ -13,7 +13,7 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name "~^(port-(?<port>.*)\.)?(?<container>.*)\.localhost"; server_name "~^(port-(?<port>.*)\.)?(?<container>.*)\.{PROXY_DOMAIN}";
location / { location / {
if ($port = "") { if ($port = "") {