vue打包部署解决页面刷新404的问题

时光5年前未分类1141

1.Nginx服务器配置:

location ^~/vue {
    alias /data/wwwroot/vue;
    index index.html;
    try_files $uri $uri/ /vue/index.html;
}

2.Apache服务器配置:

开启mod_rewrite模块,设置allowAllOveride All并在项目目录下创建.htaccess文件,内容如下:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /vue/index.html [L]
</IfModule>

相关文章

Ubuntu系统下的Mysql数据库自动备份

Ubuntu系统下的Mysql数据库自动备份

1、SSH远程连接至数据库服务器 2、登录Mysql数据库,创建备份用户帐号并赋予权限 切换目录:cd /usr/bin/ 连接MYSQL数据库(帐号root 密码123456):m...

CentOS环境PPTP搭建VPN服务器

CentOS环境PPTP搭建VPN服务器

安装包: 1、下载ppp及pptpd安装包: # wget  http://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.4-14....

JQuery实现多选项筛选功能特效

JQuery实现多选项筛选功能特效

下载地址:[Downlink href='http://pan.baidu.com/s/1bn9EYir']百度网盘[/Downlink] 密码: hf81...

Apache创建虚拟目录

1、首先查看httpd.conf或/etc/apache2/apache2.conf文件是否开启LoadModule alias_module modules/mod_alias.so模块 修改...

PDF文件转FLASH

PDF文件转FLASH

推荐一款非常实用的PDF转FLASH软件:PDF_to_Flash_Converter,可将PDF文件转换成翻书效果的FLASH,并自动生成网页文件,避免用户直接下载PDF文件,实现PDF文档在线阅读...

OSA安装过程中提示运行“install/auto_prepare.sh”安装错误

OSA安装过程中提示运行“install/auto_prepare.sh”安装错误

对于OSA安装过程中进行到如下步骤要求运行install/auto_prepare.sh 按提示在中断运行install/auto_prepare.sh后提示以下错误 instal...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。