Vue项目部署二级目录, 解决前端history路由模式刷新404问题,nginx代理跨域配置

二级目录部署,配置伪静态 解决前端history路由模式刷新404问题

  • 第一行 二级目录名称
  • 第二行 alias+网站目录 绝对路径
  • 第三行 try_files $uri $uri/ /二级目录名/index.html
location /datav {
    alias /www/wwwroot/test.xjaft.com/datav;
    try_files $uri $uri/ /datav/index.html;
}

nginx代理跨域,跨服务器

location /api{ # 接口前缀
  proxy_pass https://ahmg.yooticloud.cn; # 目标服务器
  proxy_redirect off; # 重定向关
  proxy_cookie_path / /api; # 目标服务器接口后缀
}

你可能感兴趣的:(Vue项目部署二级目录, 解决前端history路由模式刷新404问题,nginx代理跨域配置)