location / {
root /home/iwork;
index index.html;
try_files $uri /index.html; #这句关键哦
}
#子路径刷新
location ^~ /main {
try_files $uri /index.html;
}
#代理
location ^~ /iwork/ {
proxy_pass http://192.168.0.193:8080/iwork/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
nginx 只匹配 / ,剩下的应该由react-router来做