chore: 部署改为 PM2,服务监听 0.0.0.0

- 新增 ecosystem.config.js(next start -H 0.0.0.0 -p 3100)
- package.json start 脚本绑定 0.0.0.0
- DEPLOY.md 重写为 PM2 详细部署,含端口放行/防火墙/Nginx 反代/更新回滚
- .gitignore 忽略 logs/

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 19:43:10 +08:00
co-authored by Claude Opus 4.8
parent 9ce320ef11
commit 1e8396d0d3
4 changed files with 122 additions and 87 deletions
+30
View File
@@ -0,0 +1,30 @@
// PM2 部署配置 —— 联动支付 CRM
// 启动:pm2 start ecosystem.config.js
// 说明:-H 0.0.0.0 让服务监听所有网卡(外部可访问),而非仅 localhost。
// DATABASE_URL / AUTH_SECRET / AUTH_URL 由项目根目录 .env 提供(Next 自动加载)。
module.exports = {
apps: [
{
name: "liandong-crm",
// 直接调用 next 可执行文件,参数里绑定 0.0.0.0
script: "node_modules/next/dist/bin/next",
args: "start -H 0.0.0.0 -p 3100",
cwd: __dirname,
instances: 1,
exec_mode: "fork",
autorestart: true,
watch: false,
max_memory_restart: "512M",
env: {
NODE_ENV: "production",
// 如需覆盖也可在此设 PORT/HOSTNAME:
// HOSTNAME: "0.0.0.0",
// PORT: "3100",
},
error_file: "logs/err.log",
out_file: "logs/out.log",
merge_logs: true,
time: true,
},
],
};