I'm restructuring my server structure by splitting them up instead of running everything from one server.
I looked here but that just specifies what I were already doing in the original setup with just 1 server.
I'm having a structure like this:
- 2x Web-Server
- 1x Load-Balancer
- 1x Cache-Server
- 1x Worker-Server
- 1x Database-Server
Everything works great except the socket connection.
My Load-Balancer has generated an SSL cert
Usually, I point to them like this:
var server = require('https').createServer({
key: fs.readFileSync('/etc/nginx/ssl/mywebsite.com/1652307/server.key'),
cert: fs.readFileSync('/etc/nginx/ssl/mywebsite.com/1652307/server.crt'),
}, app);
However, in my socket.js
file, I'm unable to point to the certificates because they are now placed on the load balancer.
I have been setting up the infrastructure with laravel forge.
The error I get in the console is: `WebSocket is closed before the connection is established.
I'm using Nginx.
How do I go about this?