server { listen 80; server_name localhost; location = /docs { proxy_pass http://127.0.0.1:9999/docs; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location = /redoc { proxy_pass http://127.0.0.1:9999/redoc; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location = /openapi.json { proxy_pass http://127.0.0.1:9999/openapi.json; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location / { root /opt/vue-fastapi-admin/web/dist; index index.html index.htm; try_files $uri /index.html; } # PC 前端(/pc/ 前缀) location = /pc { return 302 /pc/; } location ^~ /pc/ { alias /opt/vue-fastapi-admin/web1/dist/; index index.html; try_files $uri $uri/ /index.html; } location ^~ /api/ { proxy_pass http://127.0.0.1:9999; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }