Published: 18 Aug 2025 › Updated: 18 Aug 2025
Nuxt4和Nginx布署上线 / 网络研习社#90
Nuxt和Nginx是对好搭档,让应用布署上线那是手拿把掐的事。这次喵星上线比较顺利,一把就通了。只是在渲染上还有些小问题,不知是Hive节点的问题,还是前端没设计好,Nuxt4这个新版我也是第一次用。
布署上线两步曲:一是Nuxt打包,pm2运行应用,二是Nginx反向代理和https证书。
Nuxt打包
直接yarn build , 得到 .output文件,它就是运行的文件啰。进去后,直接node server/index.mjs即可。
用pm2托管。这步也很简单,pm2 start server/index.mjs --name miao, 有这步就可运行。在浏览器中http://localhost:3000就要打开应用了。
Nginx反向代理和https证书
- 前置条件:安装好Nginx,用certbot安装ssl证书。
- 设置conf文件,重点在location这块:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
}
重启Nginx后就可访问应用啰!
Leave Nuxt4和Nginx布署上线 / 网络研习社#90 to:
Read more #cn posts
Best Posts From lemooljiang
We have not curated any of lemooljiang's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From lemooljiang
- Nextjs初体验,和Nuxt的异同
- DeepTutor:AI个性化辅导平台 / ai #57
- ComfyUI:可编程和自动化的PS / ai #56
- 将Neo4j封装进Agent / ai #55
- 闲鱼省钱大法:极限0.5折!
- 对Neo4j批量导入结构化数据 / ai #54
- langchain对neo4j进行交互,写入和查询数据 / ai #53
- 知识图谱和图数据库Neo4j的作用和使用场景 / ai #52
- SpaceX、美股和比特币
- 又是币圈血洗日!
- 链股合流,当币安也开始卖股票啰
- 天涯社区重启,爷青回?
- 诺基亚在AI时代重新杀回来啦
- 《2049:未来10000天的可能》书中的镜像世界为什么不叫元宇宙
- 今天适合吃披萨
- 开通即被封,别再给Claude送人头了!
- 两根内存条引发的“官司”
- AI·Joe V12更新, 更新GPT-5.5和DeepSeek V4 等
- 中医进校园活动反响热烈
- 猪价低伤农,猪价贵伤民