Skip to content

Instantly share code, notes, and snippets.

@eliyas5044
Last active October 5, 2023 10:25
Show Gist options
  • Save eliyas5044/a36a3c69e666463660d47f2e66fcf5f8 to your computer and use it in GitHub Desktop.
Save eliyas5044/a36a3c69e666463660d47f2e66fcf5f8 to your computer and use it in GitHub Desktop.
Laravel echo server using PM2

PM2

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment