基于nuxt.js的项目从搭建到部署步骤

一、项目搭建

1、 创建nuxt项目(确保安装了npm)

# npx create-nuxt-app  

2、 他会让你进行一些选择

Project name  //项目名称  
    
Project description  //项目描述  
    
Use a custom server framework  //服务器框架  
    
Use a custom UI framework  //UI框架  
    
Use a custom test framework  //测试框架  
    
Choose rendering mode  //nuxt模式  
    
Author name //作者名称  
    
Choose a package manager  // 包管理  

3、运行项目

# npm run dev  

二、项目安装

1、拉去项目到服务器

# git clone  

2、安装依赖

npm install  

三、打包部署

1、打包编译

# npm run build  

2、使用pm2部署项目(具体命令自行查看https://www.npmjs.com/package/pm2

# npm install -g pm2  

3、用pm2启动项目

# pm2 start npm --name "项目名" -- run start  

四、nginx反向代理端口

1、配置反向代理,修改 nginx.conf 文件

在server段里面的location添加  proxy\_pass  http://ip:端口;  

至此完成整个流程

猜你喜欢

转载自blog.csdn.net/m0_37572422/article/details/105602467