Nuxt项目部署到Linux Nginx反向代理 Kaki的博客

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;

我的部署成功画面
在这里插入图片描述

nginx安装步骤

相关nuxt部署博文

希望能帮到你!
欢迎点赞关注收藏哦 ,码云搜索KakiNakajima

发布了11 篇原创文章 · 获赞 6 · 访问量 195

猜你喜欢

转载自blog.csdn.net/qq_44988088/article/details/105327691