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

1、项目搭建

一、 建立nuxt项目(确保安装了npm)nginx

# npx create-nuxt-app

二、 他会让你进行一些选择git

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  // 包管理

三、运行项目npm

# npm run dev

2、项目安装

一、拉去项目到服务器服务器

# git clone

二、安装依赖app

npm install

3、打包部署

一、打包编译框架

# npm run build

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

# npm install -g pm2

三、用pm2启动项目ui

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

4、nginx反向代理端口

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

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

至此完成整个流程代理

相关文章
相关标签/搜索