博客前端部署方式
查看 package.json文件
执行打包命令
npm run generate
下面目录文件上传到Linux服务器中
这是我当前网站的,上传的文件
启动项目测试
npm run start
在项目根目录新建文件
pm2.json
文件内容
[
{
"name": "demo",
"script": "npm run start",
"env_dev": {
"NODE_ENV": "development"
},
"env_production": {
"NODE_ENV": "production"
}
}
]
执行命令,后台运行
pm2 start pm2.json
nuxt.config.js 文件配置
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'
})
}
}
}
本站主要用于日常笔记的记录和生活日志。本站不保证所有内容信息可靠!(大多数文章属于搬运!)如有版权问题,请联系我立即删除:“abcdsjx@126.com”。
QQ: 1164453243
邮箱: abcdsjx@126.com