Laravel Forge-Node.js Websocket超时 [英] Laravel Forge - Node.js Websocket Timeout
问题描述
我的laravel forge/数字海洋服务器上托管有一个简单的socket.io节点服务器.使用homestead在本地计算机上一切正常,但是在生产中出现以下错误:
I have a simple socket.io node server hosted on my laravel forge/digital ocean server. Everything is working find on my local machine using homestead, however I get the following error on production:
http://[IP] :[PORT]/socket.io/?EIO=3&transport=polling&t=LCPeh0O net :: ERR_CONNECTION_TIMED_OUT
http://[IP]:[PORT]/socket.io/?EIO=3&transport=polling&t=LCPeh0O net::ERR_CONNECTION_TIMED_OUT
在服务器上,我可以看到节点server.js文件正在接收来自Laravel的消息,但是客户端由于任何原因都无法连接.
On the server I can see that the node server.js file is receiving messages from Laravel but the client can't connect for whatever reason.
这与Nginx的设置有关吗?该配置是默认的伪造之一.
Is this something to do with the setup of Nginx? The configuration is the default forge one.
非常感谢您的帮助.
推荐答案
对于任何遇到此问题的人,解决方法是公开SocketIO(6001)和Redis(6379)的端口.转到伪造中的网络"选项卡并设置新的防火墙规则(如果不使用伪造,则手动进行设置).之后,一切都将正常运行.
For anyone facing this problem, the fix is to expose ports for SocketIO (6001) and Redis (6379). Go to network tab in forge and set new firewall rules (or do it manually if you are not using forge). After that everything works perfectly.
这篇关于Laravel Forge-Node.js Websocket超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!