首先需要有一个腾讯云Linux服务器
如果需要Windows界面功能,参见腾讯云如何安装有GUI的Linux版本.
配置环境
# 安装 Node.js
sudo apt-get install -y nodejs npm
# 安装 Git
sudo apt-get install -y git
# pm2
sudo npm install -g pm2
# nginx
sudo apt-get install -y nginx
部署仓库及网站环境
git clone your-repo
cd your-repo
npm install
npm run build
启动项目及配置
# 先手动启动,确保没有错误
npm run start
# 检查端口
lsof -i :3000
# 启动项目
pm2 start npm --name "nextjs-app" -- start
# 查看启动服务
pm2 show nextjs-app
# 查看端口,一般是3000
pm2 logs nextjs-app
配置腾讯云开放3000端口
# 启动防火墙
sudo ufw allow 3000
各类错误
rm -rf node_modules
rm package-lock.json
npm i
配置nginx
确保n

最低0.47元/天 解锁文章
5639

被折叠的 条评论
为什么被折叠?



