// PM2生态系统配置文件 // 用于生产环境部署 module.exports = { apps: [{ name: 'aijianhua-backend', script: './app.js', instances: 'max', exec_mode: 'cluster', env: { NODE_ENV: 'production', PORT: 3330, NODE_OPTIONS: '--max-old-space-size=4096' }, env_production: { NODE_ENV: 'production', PORT: 3330 }, // 日志配置 log_file: '/data/nodejs/aijianhua/logs/combined.log', out_file: '/data/nodejs/aijianhua/logs/out.log', error_file: '/data/nodejs/aijianhua/logs/error.log', // 进程管理 max_memory_restart: '1G', watch: false, ignore_watch: ['node_modules', 'logs', 'uploads'], // 重启策略 autorestart: true, restart_delay: 3000, // 高级配置 node_args: '--harmony', merge_logs: true, time: true }] };