module.exports = { apps: [ { name: 'nextjs-app', // 应用名称 script: 'npm', // 使用 npm 脚本 args: 'run start', // 启动应用的命令 cwd: './', // 项目的路径 watch: false, // 是否监控文件变化 env: { NODE_ENV: 'production', // 生产环境变量 }, // 在启动前执行构建 exec_mode: 'fork', // 使用 fork 模式 instances: 1, // 启动的实例数量 autorestart: true, // 自动重启 max_memory_restart: '1G', // 内存超过 1G 时自动重启 pre_start: 'npm run build', // 启动前执行构建 }, ], };