chore(deploy): Configure nginx reverse proxy and docker network
All checks were successful
continuous-integration/drone/push Build is passing

- Update admin API base URL to use nginx reverse proxy path (/api)
- Add nginx reverse proxy configuration for admin-api service with proper headers and timeouts
- Add all services to xyqj-network for internal container communication
- Reorder app-api volume mounts for consistency
- Create bridge network for service-to-service communication in docker-compose
This commit is contained in:
zpc 2026-03-29 19:31:36 +08:00
parent e4e4fb774e
commit 600eeead70
3 changed files with 25 additions and 3 deletions

View File

@ -3,8 +3,8 @@
# 应用标题
VITE_APP_TITLE=相宜相亲后台管理系统
# API基础地址 - 生产环境请修改为实际地址
VITE_API_BASE_URL=https://app.zpc-xy.com/xyqj/adminapi/api
# API基础地址 - 通过nginx反向代理到admin-api容器
VITE_API_BASE_URL=/api
# 静态资源服务器地址 - 生产环境请修改为实际地址
VITE_STATIC_BASE_URL=https://app.zpc-xy.com/xyqj/adminapi

View File

@ -4,6 +4,18 @@ server {
root /usr/share/nginx/html;
index index.html;
# 反向代理后台API
location /api/ {
proxy_pass http://xiangyi-admin-api:8080/api/;
proxy_set_header Host $host;
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;
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 60s;
}
# 处理前端路由
location / {
try_files $uri $uri/ /index.html;

View File

@ -17,6 +17,8 @@ services:
- ASPNETCORE_URLS=http://+:8080
- TZ=Asia/Shanghai
restart: unless-stopped
networks:
- xyqj-network
xiangyi-app-api:
image: 192.168.195.25:19900/xiangyixiangqin/app-api:latest
@ -24,8 +26,8 @@ services:
ports:
- "${APP_API_PORT:-2802}:8080"
volumes:
- ./configs/app-api/appsettings.json:/app/appsettings.Production.json:ro
- ./configs/app-api/appsettings.json:/app/appsettings.json:ro
- ./configs/app-api/appsettings.json:/app/appsettings.Production.json:ro
- ./configs/wwwroot:/app/wwwroot
- ./configs/apiclient_key.pem:/app/apiclient_key.pem
- ./configs/apiclient_cert.pem:/app/apiclient_cert.pem
@ -36,6 +38,8 @@ services:
- ASPNETCORE_URLS=http://+:8080
- TZ=Asia/Shanghai
restart: unless-stopped
networks:
- xyqj-network
xiangyi-admin-web:
image: 192.168.195.25:19900/xiangyixiangqin/admin-web:latest
@ -45,3 +49,9 @@ services:
environment:
- TZ=Asia/Shanghai
restart: unless-stopped
networks:
- xyqj-network
networks:
xyqj-network:
driver: bridge