diff --git a/compose.yaml b/compose.yaml index 27d9bcc..45c3e83 100644 --- a/compose.yaml +++ b/compose.yaml @@ -11,7 +11,7 @@ services: extra_hosts: - 'host.docker.internal:host-gateway' ports: - - '${APP_PORT:-80}:80' + - '${APP_PORT:-8080}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: WWWUSER: '${WWWUSER}' @@ -71,6 +71,17 @@ services: - ping retries: 3 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: # image: 'axllent/mailpit:latest' # ports: diff --git a/nginx/demo-proxy.conf b/nginx/demo-proxy.conf new file mode 100644 index 0000000..e75dccd --- /dev/null +++ b/nginx/demo-proxy.conf @@ -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; + } +}