Files
martial-web/nginx.conf
Developer 96f3b56eff
All checks were successful
continuous-integration/drone/push Build is passing
fix: 修复 API 代理路径,去掉多余的 /api 前缀
🤖 Generated with Claude Code
2025-12-13 23:11:31 +08:00

51 lines
1.6 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name localhost;
# 前端静态文件目录
root /usr/share/nginx/html;
index index.html;
# Gzip 压缩
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# 前端路由Vue Router history 模式)
location / {
try_files $uri $uri/ /index.html;
}
# API 代理到后端(直接访问宿主机上的后端服务)
location /api/ {
proxy_pass http://172.21.0.1:8123/;
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;
}
# BladeX 认证模块代理
location /blade-auth/ {
proxy_pass http://172.21.0.1:8123/blade-auth/;
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;
}
# BladeX 系统模块代理
location /blade-system/ {
proxy_pass http://172.21.0.1:8123/blade-system/;
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;
}
# 缓存静态资源
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg)$ {
expires 7d;
add_header Cache-Control "public, immutable";
}
}