1、项目打包
查看 package.json文件

执行打包命令
shell
1
npm run generate
2、上传文件
下面目录文件上传到Linux服务器中

这是我当前网站的,上传的文件

启动项目测试
text
1
npm run start
3、pm2 配置
在项目根目录新建文件
pm2.json
文件内容
json
1
2
3
4
5
6
7
8
9
10
11
12
[
{
"name": "demo",
"script": "npm run start",
"env_dev": {
"NODE_ENV": "development"
},
"env_production": {
"NODE_ENV": "production"
}
}
]
执行命令,后台运行
text
1
pm2 start pm2.json
4、文件配置
nuxt.config.js 文件配置
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'server',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/jpg', href: '/img/logo.png' }
],
script:[
{
src : '/editor.md/jquery/jquery.min.js'
},
{
src : '/plug/editor.md/lib/codemirror/modes.min.js'
}
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'element-ui/lib/theme-chalk/index.css',
'jodit/build/jodit.min.css'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/element-ui',
{ src: "~/plugins/vue-swiper.js", ssr: false }
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// Simple usage
'cookie-universal-nuxt',
// With options
['cookie-universal-nuxt', { alias: 'cookiz' ,parseJSON: false}],
],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: [/^element-ui/],
},
router:{
extendRoutes(routes){
routes.push({
path:"/",
redirect:'/list'
})
}
}
}





评论
登录后即可评论
分享你的想法,与作者互动
暂无评论