module.exports = { apps: [ { name: 'landingpage', script: 'node_modules/.bin/next', args: 'start -H 0.0.0.0 -p 3011', cwd: '/home/coder/myprojects/assetx/landingpage', interpreter: 'node', instances: 1, exec_mode: 'fork', // 环境变量 env: { NODE_ENV: 'production', PORT: 3011, }, // 自动重启配置 autorestart: true, watch: false, max_memory_restart: '500M', // 日志配置 error_file: '~/.pm2/logs/landingpage-error.log', out_file: '~/.pm2/logs/landingpage-out.log', log_file: '~/.pm2/logs/landingpage-combined.log', time: true, log_date_format: 'YYYY-MM-DD HH:mm:ss Z', merge_logs: true, // 启动延迟(避免端口冲突) listen_timeout: 10000, kill_timeout: 5000, // 最大重启次数(防止无限重启) max_restarts: 10, min_uptime: '10s', // 其他配置 shutdown_with_message: true, wait_ready: false, } ] };