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
41 lines
1.1 KiB
Nginx Configuration File
41 lines
1.1 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
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;
|
|
}
|
|
|
|
# 静态资源缓存
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# 安全头
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
# 压缩
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
|
|
}
|