vue项目打包后部署nginx,找不到页面
方式一:(mode:history)webpack.base.conf.jsassetsRoot: path.resolve(__dirname, '../dist'),assetsSubDirectory: 'static',assetsPublicPath: '/',// 注意是绝对路径nginx 配置文件http{server {...
·
方式一:(mode:history)
webpack.base.conf.js
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/', // 注意是绝对路径
nginx 配置文件
http{
server {
location / {
try_files $uri $uri/ /index.html; // 加上这行配置
}
}
}
方式二:(mode:hash)
webpack.base.conf.js
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './', // 注意是相对路径
更多推荐
已为社区贡献2条内容
所有评论(0)