一.一块部署[springboot打jar包]
linux服务器环境:jdk mysql
1.把vue的项目用npm run build命令打包,打包完成后,会生成dist文件夹.
2.打开springboot项目,在src/resources目录下新建一个static文件夹,将dist文件夹中的所有文件放到static下.
3.选中springboot项目,右击,选择Run As 最后一个Run Configurations,点击New_configuration,完成打包,双击左侧Maven Build,出来New_configuration,右侧Goals改为package,点击Run As等待完成打包,console出现"BUILD SUCCESS"字样,为打包成功.在target文件夹下,找到xxx.jar包,放到服务器上.
4.用nohup java -jar xxx.jar[项目打成的jar名,最好是输全路径] &命令启动.
二.分开部署(一)
linux环境jdk mysql tomcat nginx vue
修改vue项目中config/index.js
// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')
module.exports = {
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
},
dev: {
env: require('./dev.env'),