博客
关于我
vue打包以及在Apache环境下的配置
阅读量:443 次
发布时间:2019-03-06

本文共 860 字,大约阅读时间需要 2 分钟。

vue打包,我们都清楚,实在记不住命令的可以去package.json中看:

npm run build

打包后会生成dist文件夹,将dist文件夹下的所有文件复制到Apache下的www的文件夹下,然后在localhost的80端口下即可访问。

但此时还有一个问题:点击链接改变路由后,服务器会报错!如下图:

解决方法:

打开apache的配置文件

释放rewrite模块,寻找以下代码,将前面的#去掉

LoadModule rewrite_module modules/mod_rewrite.so

寻找以下代码块,将AllowOverride后面改成all

AllowOverride all Require all denied

 

#    # AllowOverride controls what directives may be placed in .htaccess files.    # It can be "All", "None", or any combination of the keywords:    #   AllowOverride FileInfo AuthConfig Limit    #    AllowOverride all    #    # Controls who can get stuff from this server.    #

httpd.conf文件修改完之后,还需要在根目录下添加.htaccess的文件,并在文件中添加以下代码块

RewriteEngine On RewriteBase / RewriteRule ^index\.html$ [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.html [L]

修改完成后,重启服务器即可。

转载地址:http://yiufz.baihongyu.com/

你可能感兴趣的文章
mysql 5.6 修改端口_mysql5.6.24怎么修改端口号
查看>>
MySQL 8.0 恢复孤立文件每表ibd文件
查看>>
MySQL 8.0开始Group by不再排序
查看>>
mysql ansi nulls_SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON 什么意思
查看>>
multi swiper bug solution
查看>>
MySQL Binlog 日志监听与 Spring 集成实战
查看>>
MySQL binlog三种模式
查看>>
multi-angle cosine and sines
查看>>
Mysql Can't connect to MySQL server
查看>>
mysql case when 乱码_Mysql CASE WHEN 用法
查看>>
Multicast1
查看>>
MySQL Cluster 7.0.36 发布
查看>>
Multimodal Unsupervised Image-to-Image Translation多通道无监督图像翻译
查看>>
MySQL Cluster与MGR集群实战
查看>>
multipart/form-data与application/octet-stream的区别、application/x-www-form-urlencoded
查看>>
mysql cmake 报错,MySQL云服务器应用及cmake报错解决办法
查看>>
Multiple websites on single instance of IIS
查看>>
mysql CONCAT()函数拼接有NULL
查看>>
multiprocessing.Manager 嵌套共享对象不适用于队列
查看>>
multiprocessing.pool.map 和带有两个参数的函数
查看>>