Nuxt项目部署到Linux Nginx反向代理 Kaki的博客
1.nuxt 项目先本地执行 yarn build命令
2.拷贝下面标记的文件至服务器部署目录/opt/deploy/front
3.进入目录执行(linux)
cd /opt/deploy/front
npm install -production
npm run start
4.nginx配置
server {
listen 80;
server_name www.test.com;
location / {
root /opt/deploy/front; # 前端文件目录
proxy_pass http://127.0.0.1:3000;
}
}
注意:在执行npm install -production时建议使用淘宝的npm镜像
淘宝镜像安装步骤
1.安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org;
3.查看当前镜像库
npm config get registry;
我的部署成功画面
希望能帮到你!
欢迎点赞关注收藏哦 ,码云搜索KakiNakajima