如果你正在尝试将基于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模式发布配置的更多相关文章

  1. Apache支持Vue router使用 HTML5History 模式

    一.前言 前端Vue router 使用history模式,URL会比hash模式好看,这种模式要玩好,还需要后端配置支持,否则会报404错误. 注:1.前端代码省略. 2.此处后台使用Apache服 ...

  2. vue路由history模式,nginx配置

    nginx配置内容 # For more information on configuration, see: # * Official English Documentation: http://n ...

  3. Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误

    使用Vue-cli3.x开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chu ...

  4. vue 中 history 模式的配置和打包

    在使用 vue 进行项目开发中,默认的路由形式是 hash,表现形式就是 url 中始终带有 # 号,在后台管理类的项目中并不影响使用,但是在特殊场景,比如微信分享的H5链接中,微信会自动拼接参数,由 ...

  5. 如何去除vue项目中的 # — vue路由的History模式

    前言 在创建的 router 对象中,如果不配置 mode,就会使用默认的 hash 模式,该模式下会将路径格式化为 #! 开头. 添加 mode: 'history' 之后将使用 HTML5 his ...

  6. vue react 路由history模式刷新404问题解决方案

    vue单页因微信分享和自动登录需要,对于URL中存在’#’的地址,处理起来比较坑.用history模式就不会存在这样的问题.但是换成history模式,就会有个新的问题,就是页面刷新后,页面就无法显示 ...

  7. 每天一点点之vue框架开发 - History 模式下线上路由报404错误

    vue-router 默认 hash 模式 —— 使用 URL 的 hash 来模拟一个完整的 URL,于是当 URL 改变时,页面不会重新加载. 如果不想要很丑的 hash,我们可以用路由的 his ...

  8. vue history模式 apache配置

    我的服务器apache 版本是2.4.6 看文档上面说加那些代码,但是加上去重启服务器就不能重启,显示代码错误,然后百度查开启mod_rewrite这个重写URL 弄了半天也不会,百度上面的不知道是不 ...

  9. Vue之八 HTML5 History模式

    nginx配置 location / { root /webroot/www/ShopMall3; try_files $uri $uri/ /index.html; } /:访问路径: root:服 ...

随机推荐

  1. Python基础 ----- 流程控制

    ------   条件判断 if 条件判判断语法: 条件判断注意: 1.由if 条件起始 2.关键字后面要加一个空格 3.条件后面接: 4.符合python代码缩进格式 5.条件判断可以有多种组合方式 ...

  2. vue 利用原声input上传图片并预览并删除

    <template> <div class="com-upload-img"> <div class="img_group"> ...

  3. angular ViewChild ContentChild 系列的查询参数

    官方说明 官方文档 在调用 NgAfterViewInit 回调函数之前就会设置这些视图查询. 元数据属性: selector - 用于查询的指令类型或名字. read - 从查询到的元素中读取另一个 ...

  4. 进军的socket

    在学socket有时候我们会遇到这种问题: 解决方法一: 在服务端中加入:severTCP.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ...

  5. Replace To Make Regular Bracket Sequence

    Replace To Make Regular Bracket Sequence You are given string s consists of opening and closing brac ...

  6. import os, glob, fnmatch--Python os/glob/fnmatch主要函数总结

    auther: Lart date: 2019-01-17 update: 2019-01-18 09:55:36 --- import os, glob, fnmatch 针对某些操作, 官方推荐这 ...

  7. appnium启动报错Encountered internal error running command: Error: Error occured while starting App. Original error: Permission to start activity denied.

    说明写错了activity 首先查看一下activity,使用命令 打开被测app,输入命令adb shell dumpsys window | findstr mCurrentFocus 看似这个a ...

  8. mysql8.0 1251错误

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; ALTER USER '; FLUSH PR ...

  9. bootstrap-datepicker简单使用

    粗略整理,可能存在其他的方式请大家多多指教 选择年份 html <div class="dropdown"> <label class="search- ...

  10. .Net QQ互联教程

    qq互联只需要备案即可申请,申请成功后可以到qq互联官网查看教程,本站开始想使用js的教程但是由于本站需要绑定本站的账号用js教程无法完成,所以使用原始的oauth2.0来完成. 申请qq互联接口 q ...