在项目中使用vue的history模式,需要配置文件,使用到宝塔面板的服务器。现在记录存放位置。
/www/server/panel/vhost/nginx
配置history模式
try_files $uri $uri/ /index.html qkbim/index.html;
配置跨域
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'POST,PUT,GET,DELETE';
add_header Access-Control-Allow-Headers 'version, access-token, user-token, Accept, apiAuth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With';

本文介绍了如何在Vue项目中启用history模式,并在宝塔面板的服务器上进行配置,涉及try_files规则及跨域设置,适合前端开发者参考。
5338

被折叠的 条评论
为什么被折叠?



