22301080 | 6af19da | 2025-06-03 16:57:13 +0800 | [diff] [blame^] | 1 | server { |
| 2 | listen 80; # 代理默认端口,可改 |
| 3 | server_name localhost; |
| 4 | |
| 5 | root /var/www/html; |
| 6 | index index.html; |
| 7 | |
| 8 | location / { |
| 9 | try_files $uri $uri/ /index.html; |
| 10 | } |
| 11 | |
| 12 | # 代理 /api/v1/ 到后端服务 |
| 13 | location /api/v1/ { |
| 14 | proxy_pass http://127.0.0.1:8088; # 你的后端暴露位置 |
| 15 | proxy_http_version 1.1; |
| 16 | proxy_set_header Upgrade $http_upgrade; |
| 17 | proxy_set_header Connection 'upgrade'; |
| 18 | proxy_set_header Host $host; |
| 19 | proxy_cache_bypass $http_upgrade; |
| 20 | } |
| 21 | |
| 22 | location = /favicon.ico { log_not_found off; access_log off; } |
| 23 | location = /robots.txt { log_not_found off; access_log off; allow all; } |
| 24 | location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { |
| 25 | expires max; |
| 26 | log_not_found off; |
| 27 | } |
| 28 | } |