How to configure websockets in Laravel using Soketi on a server provisioned in Laravel forge
After hours watching videos, reading articles and answers on Stackoverflow, in the end I gathered the best of each one and got a step by…
How to configure websockets in Laravel using Soketi on a server provisioned in Laravel forge
After hours watching videos, reading articles and answers on Stackoverflow, in the end I gathered the best of each one and got a step by step on how to configure websockets in Laravel using Soketi in forge.
It’s just a few steps, I’ll be as direct as possible. I’m going to assume that you already have a server in forge with your application working correctly and that all that remains is to configure the websocket.
The first step is to make sure that in your DNS manager, you have 2 records of type A, both pointing to the IP of your server in the forge, one of them will be the main domain of your application, through which it will be accessed on the web , for example ‘my-laravel-app.com’, and the other will be a subdomain ‘socket.my-laravel-app.com’, in my case, I am using Cloudflare as DNS manager, so after doing the listed steps above, I will have something like:

On both registrations I disabled the Cloudflare proxy, because I will be using an SSL certificate provisioned by Forge.
Then, inside your application’s server in Forge add a website with the respective subdomain created in the previous step along with an SSL certificate that can be added through the panel in the SSL tab, we arrive at something similar to:

Now let’s create a Daemon to keep soketi running in the background, go to the Daemons tab on your server and add one with the following configuration:
- Command = soketi start
- Stops seconds = 60
- Stop Signal = SIGINT
Leave all other fields as they are, you don’t need to change or remove anything.
With soketi running in the background and Cloudflare entries pointing to the server, the penultimate step is to change our subdomain’s NGINX configuration to redirect all requests to 127.0.0.1:6001 which is where our websocket server is running in the background.
Change the following line in the NGINX configuration
location / {
try_files $uri $uri/ /index.php?$query_string;
}
by
location / {
proxy_pass http://127.0.0.1:6001;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
This will cause requests arriving at the subdomain to be redirected to the soketi in the background.
The last step is to configure your application’s .env for these changes, the final result is
.env

and in your application’s bootstrap.js

Now your application will be able to connect with the websocket.
메타데이터
- post_id
- d1cfac75bb4b
- slug
- how-to-configure-websockets-in-laravel-using-soketi-on-a-server-provisioned-in-laravel-forge-d1cfac75bb4b
- url
- https://medium.com/@marlonlcosta.dev/how-to-configure-websockets-in-laravel-using-soketi-on-a-server-provisioned-in-laravel-forge-d1cfac75bb4b
- canonical_url
- https://medium.com/@marlonlcosta.dev/how-to-configure-websockets-in-laravel-using-soketi-on-a-server-provisioned-in-laravel-forge-d1cfac75bb4b
- author_url
- https://medium.com/@marlonlcosta.dev
- status
- ok
- fetched_at
- 2026-07-25 22:19:32