feat: 添加 Nginx 反向代理並統一容器名稱為 star-erp
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 1m38s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-15 17:35:09 +08:00
parent b685c818a4
commit 4b2ccd36b8
2 changed files with 38 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ services:
extra_hosts: extra_hosts:
- 'host.docker.internal:host-gateway' - 'host.docker.internal:host-gateway'
ports: ports:
- '${APP_PORT:-80}:80' - '${APP_PORT:-8080}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment: environment:
WWWUSER: '${WWWUSER}' WWWUSER: '${WWWUSER}'
@@ -71,6 +71,17 @@ services:
- ping - ping
retries: 3 retries: 3
timeout: 5s timeout: 5s
proxy:
image: 'nginx:alpine'
container_name: star-erp-proxy
ports:
- '80:80'
volumes:
- './nginx/demo-proxy.conf:/etc/nginx/conf.d/default.conf:ro'
networks:
- sail
depends_on:
- laravel.test
# mailpit: # mailpit:
# image: 'axllent/mailpit:latest' # image: 'axllent/mailpit:latest'
# ports: # ports:

26
nginx/demo-proxy.conf Normal file
View File

@@ -0,0 +1,26 @@
server {
listen 80;
server_name 192.168.0.103;
# koori 租戶
location /koori {
proxy_pass http://star-erp-laravel:80;
proxy_set_header Host koori.star-erp.demo:8080;
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;
# 移除路徑前綴
rewrite ^/koori/(.*) /$1 break;
rewrite ^/koori$ / break;
}
# 總後台(預設)
location / {
proxy_pass http://star-erp-laravel:80;
proxy_set_header Host star-erp.demo:8080;
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;
}
}