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

JimNayzium's avatar

Reverb Ports / Local vs Production

Somehow when setting up my Laravel 11 and Reverb locally I read somewhere to use Port: 6001 locally. I got it all working locally and am now uploading things to my host server.

Of course my config/reverb.php file and .env files still are saying Port: 6001 for reverb settings and I am just making sure I should be changing that to 8080 for production?

I honestly don't truly understand it all fully but get the concepts. I just wanted to make sure changing it all to 8080 was the right thing to do.

Also, I edit in VSCODE, and Push/Commit to github, and my cloudways hosting company allows for an option to "deploy from github repo" directly, so I assume what I want to do is add the reverb.php to the gitignore after I get it all setup like I do the .env file so when I deploy the changes it won't keep resetting itself back to Port: 6001.

My last question then is -> Why do I need port 6001 locally? Can I not just use port 8080 for local development ?

0 likes
3 replies
LaryAI's avatar
Level 58

To address your questions regarding setting up Reverb with Laravel and handling different environments, let's break it down:

  1. Port Configuration for Local vs Production:

    • Local Development: It's common to use different ports for local development to avoid conflicts with other services. Port 6001 is often used for WebSocket connections in Laravel applications, especially when using broadcasting with services like Pusher or Laravel Echo Server. This is likely why you were using port 6001 locally.
    • Production Environment: The port you use in production depends on your server configuration and what ports are open and available. Port 8080 is a common alternative to the default HTTP port 80, but it's not a requirement unless your hosting environment specifies it. You should confirm with your hosting provider which port to use for WebSocket connections.
  2. Configuration Management:

    • It's a good practice to manage environment-specific configurations using the .env file. This way, you can have different settings for local and production environments without hardcoding them in your configuration files.
    • You should not add config/reverb.php to .gitignore if it contains default settings that are necessary for your application. Instead, ensure that sensitive or environment-specific settings are stored in the .env file, which should already be in your .gitignore.
  3. Using Git and Deployment:

    • When deploying from a GitHub repository, ensure that your .env file is correctly set up on your production server. This file should contain the correct port and other environment-specific settings.
    • You don't need to add reverb.php to .gitignore unless it contains sensitive information or environment-specific settings that should not be version-controlled.
  4. Port Usage in Local Development:

    • You can use any available port for local development, including 8080, as long as it doesn't conflict with other services. The choice of port 6001 is likely due to its common use for WebSocket connections, but you can configure your local environment to use 8080 if it suits your setup better.

Here's a general approach to managing your configuration:

  1. .env File:

    REVERB_PORT=6001
    
  2. config/reverb.php:

    return [
        'port' => env('REVERB_PORT', 6001),
    ];
    
  3. Deployment:

    • Ensure your production .env file is set with the correct port:
      REVERB_PORT=8080
      

By following these steps, you can maintain a clean separation between your local and production configurations, making your deployment process smoother.

JimNayzium's avatar

When I got it all setup as instructed by the AI response, I then when to start reverb and it told me that 8080 was already in use at: at vendor/react/socket/src/TcpServer.php:188 which I didn't install on purpose?

However, I have installed and uninstalled a few things like Horizon. Could something else have installed React in my vendor folder?

My package.json is clean I think:

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@inertiajs/vue3": "^1.0.14",
        "@tailwindcss/forms": "^0.5.7",
        "@tailwindcss/typography": "^0.5.10",
        "@vitejs/plugin-vue": "^5.0.0",
        "autoprefixer": "^10.4.16",
        "axios": "^1.6.4",
        "laravel-vite-plugin": "^1.0",
        "postcss": "^8.4.32",
        "tailwindcss": "^3.4.0",
        "vite": "^5.0",
        "vue": "^3.3.13"
    }
}
Lumethys's avatar

a port is just an address point to something in the network.

Ever go to a restaurant and they have the number on the table? You can sit at any table you want if there is no one sitting at that table. Waiters will use that table's number instead of yelling your name: "1 burger to table 10", "table 2 is calling for order", "checkout for table 5"?

Ports work exactly like that, they are just number that point to something.

Assigning a port to a program is akin to have that program telling the OS "hey, if anyone want to find me, tell them to go to room number <PORT NUMBER>"

In a more technical terms: Your computer has a lot of programs running on it, and if others want to send information to that program, there need to be an identifier, an address, to send to.

If you have 100 laravel apps running that the same time, how would the webserver know which one to send a request to?

Apart from a few special ports, such as (80 for HTTP and 443 for HTTPS), all ports are the same. There is 0 differences between 6001 and 8080.

Please or to participate in this conversation.