I’m using socket.io and laravel echo server with Redis and also SSL installed on the server but the socket.io file is not loading on the production ubuntu server everything works fine in my local window I’m not sure if I need any other configurations for production I also allow UFW 6001 port.
this is my laravel-echo-server.json file.
{
"authHost": "https://flowerful.initialengine.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "bb6e18dd7fd2e7aa",
"key": "c52b04fae249d3cb303b317b281b1599"
}
],
"rejectUnauthorized": false,
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "3001",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "/etc/letsencrypt/live/flowerful.initialengine.com/fullchain.pem",
"sslKeyPath": "/etc/letsencrypt/live/flowerful.initialengine.com/privkey.pem",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "https://flowerful.initialengine.com",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
I search on different portals and get some help and I apply some things following.
- Allow ufw port 6001
- run command
laravel-echo-server init
and create a config file - give SSL the right paths
Some things in my mind may be happening.
I installed virtual host may be apache2 not allow the domain to run on 6001 port
the URL is that is not working.
https://flowerful.initialengine.com:6001/socket.io/?EIO=3&transport=polling&t=NLFfgwB
3
Answers
I think you should generate and set the right SSL file with
.cert
and ‘.key’ extension forlaravel-echo-server
config like this:In my case, just port 6001 was closed.
Check on server is project serve on your port:
If you receive http headers, that mean is all ok and you need just open port.
For open port:
If there is not a port problem on the server then you can do this my personal experience test.
What I would personally do is use an Nginx server as a reverse proxy. That way you could install an SSL certificate via Nginx and then proxy the traffic to the Laravel echo server.
The proxy rule would look as follows:
Then rather than using
https://your_domain:6001
in your frontend, you would usehttps://your_domain/ws
which would internally proxy the traffic to the echo server.Let me know how it goes!
If you want to learn more about the production