We can keep running of Laravel echo server using pm2.
- Create a pm2 config file
nano ecosystem.config.js
- Update the config file
module.exports = {
apps: [
{
name: 'laravel-echo-server',
script: 'laravel-echo-server',
instances : 1,
exec_mode : 'fork',
interpreter: 'node',
args: 'start',
autorestart: true,
max_memory_restart: '200M',
error_file: './storage/logs/pm2/pm2.error.log',
out_file: './storage/logs/pm2/pm2.out.log',
pid_file: './storage/logs/pm2/pm2.pid.log',
cwd: "/var/www/api",
},
],
}
- Start the process
pm2 start laravel-echo-server