Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MimisK's avatar

Multiple Laravel Reverb Instances on a Single Forge Server — Possible?

On a Forge server with multiple different sites, how can we handle multiple instances of Laravel Reverb? First of all, will it even work? Has anyone tested this?

I had an issue with two sites — staging and production — where only one Reverb instance would work properly.

0 likes
1 reply
LaryAI's avatar

Yes, you can run multiple Laravel Reverb instances on a single Forge server, but you need to ensure that each instance uses a different port and has its own configuration. By default, Reverb listens on port 8080, so if you have multiple sites, their Reverb instances will conflict unless you change the ports.

Here's how you can set it up:

  1. Configure Different Ports for Each Site

    In each site's .env file, set a unique port for Reverb:

    REVERB_PORT=8081   # For staging
    REVERB_PORT=8082   # For production
    

    Make sure these ports are open in your server's firewall.

  2. Update Broadcasting Configuration

    In config/broadcasting.php, ensure the reverb connection uses the environment variable:

    'connections' => [
        'reverb' => [
            'driver' => 'reverb',
            'host' => env('REVERB_HOST', '127.0.0.1'),
            'port' => env('REVERB_PORT', 8080),
        ],
    ],
    
  3. Update Your Frontend

    When connecting to Reverb from your frontend (e.g., with Laravel Echo), specify the correct port:

    window.Echo = new Echo({
        broadcaster: 'reverb',
        host: window.location.hostname + ':8081' // or ':8082' for production
    });
    
  4. Start Reverb for Each Site

    SSH into your server, navigate to each site's directory, and start Reverb with the correct environment:

    php artisan reverb:start
    

    Or, if you're using Supervisor, ensure each site's Supervisor config uses the correct path and environment.

  5. Supervisor Example

    Example Supervisor config for staging (/etc/supervisor/conf.d/staging-reverb.conf):

    [program:staging-reverb]
    process_name=%(program_name)s
    command=php /home/forge/staging.yoursite.com/artisan reverb:start
    autostart=true
    autorestart=true
    user=forge
    redirect_stderr=true
    stdout_logfile=/home/forge/staging.yoursite.com/storage/logs/reverb.log
    environment=REVERB_PORT="8081",APP_ENV="staging"
    

    And similarly for production, but with a different port and path.

Summary:
Yes, it's possible to run multiple Reverb instances on a single Forge server. Just ensure each site uses a different port and the correct environment variables. This setup is similar to running multiple queue workers or websockets servers for different sites on the same machine.

Let me know if you need a sample Supervisor config or more details!

Please or to participate in this conversation.