Vue部署
1 分钟 1835 字 |
Vue部署
打包
- 在
config
中的index.js里build下修改webpack配置:
assetsPublicPath: '/dist/'
- 在
router
中的index.js配置中加上:
export default new Router({
mode: 'history',
scrollBehavior: () => ({ y: 0 }),
base: '/dist/', // 加上这一行
routes: constantRouterMap
})
- 打包build:
npm run build
安装Apache2
- 安装:
yum install httpd
- 配置:
vim /etc/httpd/conf/httpd.conf
- 启动:
systemctl start httpd.service
- 开机启动:
systemctl enable httpd.service
部署
将vue工程中的
dist
文件夹移动到/var/www/html/
下:mv dist /var/www/html/
访问:
localhost:[port]/dist/
参考
[ 1 ] http://www.codebaoku.com/it-js/it-js-205207.html
[ 2 ] https://www.jianshu.com/p/5b8903709e66
~ ~ The End ~ ~
分类标签:技术,vue
文章标题:Vue部署
文章链接:http://120.46.217.131:82/archives/35/
最后编辑:2022 年 9 月 17 日 21:19 By Yang
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
文章标题:Vue部署
文章链接:http://120.46.217.131:82/archives/35/
最后编辑:2022 年 9 月 17 日 21:19 By Yang
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)