This guide covers configuring Laravel Reverb for production using services like Laravel Forge or Ploi.
Add this to your nginx site configuration's server block:
location /app {
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://0.0.0.0:8080;
}Note
/appis Reverb's path, not your application path. Don't change it.- Port
8080is Reverb's default listening port. Adjust if running multiple Reverb instances on the same server.
Important
Restart Nginx after making these changes.
Add these configurations to your .env file:
REVERB_APP_ID=your-app-id
REVERB_APP_KEY=set-a-key-here
REVERB_APP_SECRET=set-a-secret
REVERB_HOST=site.com
REVERB_PORT=443
REVERB_SCHEME=https
REVERB_SERVER_HOST=127.0.0.1
REVERB_SERVER_PORT=8080
BROADCAST_CONNECTION=reverb
### DO NOT REMOVE ###
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
# If you remove this, Reverb will break.Note
- Set
REVERB_HOSTto your site URL without HTTP/HTTPS - Configure unique app ID, key, and secret
- Ensure port numbers are consistent with Nginx configuration
- Set
BROADCAST_CONNECTIONtoreverb - Include VITE variables if your app uses VITE
Tip
Clear your application cache after making changes.
Create a daemon on your server with this command (adjust the file path):
php /home/ploi/site.com/artisan reverb:start --host=127.0.0.1 --port=8080 --no-interactionTip
Add --debug option for more detailed logging.
Caution
Ensure port numbers are consistent throughout all configurations to avoid issues.
This should result in a successful Reverb setup. This code was taken from my production Reverb app on Ploi.
On Ploi, it works but just remember to Restart the Nginx.
Thank you for this !