server { listen 80; server_name localhost; # API Gateway 代理 location /api/ { proxy_pass http://gateway:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # 侧边栏H5 location /sidebar/ { alias /usr/share/nginx/html/sidebar/; try_files $uri $uri/ /sidebar/index.html; } # 管理后台 location /admin/ { alias /usr/share/nginx/html/admin/; try_files $uri $uri/ /admin/index.html; } # WebSocket 代理 location /ws/ { proxy_pass http://recommendation-service:8085; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }