简体   繁体   English

Websocket 无法在 Ubuntu 上打开端口

[英]Websocket not able to open the port on Ubuntu

I am using websocket bundle on a symfony based web portal while everything seems to work on localhost things break down when I moved the portal on production server.我在基于 symfony 的 Web 门户上使用 websocket,而当我在生产服务器上移动门户时,一切似乎都可以在 localhost 上工作。

On localhost the host i am using is 127.0.0.1 and the port is 8080 so when I moved to the production I had to change the ip to the production ip and I had to then tell ubuntu server to open the port 8080 using the following command在本地主机上,我使用的主机是127.0.0.1 ,端口是8080所以当我转移到生产环境时,我必须将 ip 更改为生产 ip,然后我必须告诉 ubuntu 服务器使用以下命令打开端口 8080

sudo ufw allow 8080/tcp which gave me the output of sudo ufw allow 8080/tcp这给了我输出

Rule added 
Rule added (v6)

I then ran the command sudo ufw status to see if the port has been added in firewall and i can see that it is然后我运行命令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)

However the error remains但是错误仍然存​​在

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

I also tried the command telnet 111.222.333.44 8080 and this gives me the following error我还尝试了命令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

So this tells me the port 8080 is not open, what commands do I need to use to open this?所以这告诉我8080端口没有打开,我需要使用什么命令来打开它? I am using Ubuntu 15.10我正在使用 Ubuntu 15.10

Any help will be really appreciated.任何帮助将不胜感激。

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

sudo ufw allow 6001/tcp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM