可以在vue-router官网找到解决方案 在nginx文件根目录下的 conf/nginx.conf 文件中配置
http {
server {
location / {
try_files $uri $uri/ /index.html;
}
}
}
将location这部分复制到server里
跨域也在这里写
http {
server {
location / {
try_files $uri $uri/ /index.html;
}
location /prod_api {
proxy_pass 基地址; //不用加引号
}
}
}