springboot+vue在linux服务器部署

一.一块部署[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'),
  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值