server { listen 8089; listen [::]:8089; server_name localhost; # 后台服务配置,配置了这个location便可以通过访问 location ^~ /military { proxy_pass http://military-system:8080/military/; proxy_set_header Host $host:8089; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 location / { root /usr/share/nginx/html; index index.html index.htm; if (!-e $request_filename) { rewrite ^(.*)$ /index.html?s=$1 last; break; } } }