location / { root /www/server/tomcat8/webapps/eduadmin; index index.html index.htm; try_files $uri $uri/ /index.html;#解决登录之后刷新404 } location /api { proxy_pass http://localhost:8000/education;#前端能够访问到后端 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; # 解决session共享问题 同步/education 和 /api proxy_cookie_path /education /api; # root html; # index index.html index.htm; }