Websocket无法在Ubuntu上打开端口

时间:2016-06-29 08:38:20

标签: symfony websocket ubuntu-15.10

我在基于symfony的门户网站上使用websocket bundle,而当我在生产服务器上移动门户网站时,一切似乎都在本地主机上工作。

在localhost上我使用的主机是127.0.0.1,端口是8080所以当我转到生产时我必须将ip更改为生产ip,然后我必须告诉ubuntu服务器使用以下命令打开端口8080

sudo ufw allow 8080/tcp给了我输出

Rule added 
Rule added (v6)

然后我运行命令sudo ufw status以查看端口是否已添加到防火墙中,我可以看到它是

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
8080                       ALLOW       Anywhere
8080/tcp                   ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
8080 (v6)                  ALLOW       Anywhere (v6)
8080/tcp (v6)              ALLOW       Anywhere (v6)

但错误仍然存​​在

WebSocket connection to 'ws://111.222.333.44:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

我也尝试了telnet 111.222.333.44 8080命令,这给了我以下错误

Trying 111.222.333.44...
telnet: connect to address 111.222.333.44: Connection refused
telnet: Unable to connect to remote host

所以这告诉我端口8080没有打开,我需要用什么命令来打开它?我正在使用Ubuntu 15.10

任何帮助都将非常感激。

1 个答案:

答案 0 :(得分:0)

尝试打开端口6001,这是websockets使用的端口:

sudo ufw allow 6001/tcp