vue-router的history模式发布配置

发布时间:2019-05-28 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了vue-router的history模式发布配置脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

如果你正在尝试将基于vue-router的项目部署到windows中,希望本文能够有所帮助。

iis配置

无需安装其他组件,将错误页指向index.html即可
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <customErrors mode="On" defaultRedirect="index.html">
            <error statusCode="404" redirect="index.html" />
        </customErrors>
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Custom">
            <remove statusCode="404" />    
            <remove statusCode="500" />          
            <error statusCode="500" path="/index.html" responseMode="ExecuteURL" />
            <error statusCode="404" path="/index.html" responseMode="ExecuteURL" />
        </httpErrors>
      
    </system.webServer>
</configuration>

nginx配置

启动如遇问题尝试使用命令创建/logs/nginx.pid文件:nginx -c conf/nginx.conf
不要设置环境变量,重启命令:start nginx -s -reload
server {
    listen       3355;
    location / {
        root F:/dist;
        index index.html;
        try_files $uri $uri/ /index.html;
    }      
}

脚本宝典总结

以上是脚本宝典为你收集整理的vue-router的history模式发布配置全部内容,希望文章能够帮你解决vue-router的history模式发布配置所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:Vue