server { | |
listen 80; # 代理默认端口,可改 | |
server_name localhost; | |
root /var/www/html; | |
index index.html; | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
# 代理 /api/v1/ 到后端服务 | |
location /api/v1/ { | |
proxy_pass http://team2.10813352.xyz:8088; # 你的后端暴露位置 | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
location = /favicon.ico { log_not_found off; access_log off; } | |
location = /robots.txt { log_not_found off; access_log off; allow all; } | |
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { | |
expires max; | |
log_not_found off; | |
} | |
} |