feat: 添加 Nginx 反向代理並統一容器名稱為 star-erp
This commit is contained in:
13
compose.yaml
13
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:
|
||||
|
||||
26
nginx/demo-proxy.conf
Normal file
26
nginx/demo-proxy.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user