端口正在侦听,但无法从远程连接

我有一个在虚拟机上运行的催化剂服务器。

[info] Hello powered by Catalyst 5.90103 HTTP::Server::PSGI: Accepting connections at http://0:3009/ 

并在虚拟机内连接

 vagrant@precise32:/var/log/apache2$ curl 'http://localhost:3009' DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" etc ... 

港口似乎在倾听

 vagrant@precise32:/var/log/apache2$ netstat -an | grep "LISTEN " tcp 0 0 0.0.0.0:36300 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:3009 0.0.0.0:* LISTEN 

远程连接,我可以看到端口80,但不是3009

 curl 'http://localhost:80' curl: (52) Empty reply from server curl 'http://localhost:3009' curl: (7) Failed to connect to localhost port 3009: Connection refused 

我见过类似的线程,但没有任何帮助。 这是iptables

 vagrant@precise32:/var/log/apache2$ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 

并且防火墙closures

 vagrant@precise32:/var/log/apache2$ sudo ufw status Status: inactive 

我在虚拟机非常新,我不确定这是一个主机问题,一个Apache的问题或一个catarals问题。 我曾尝试运行一个python服务器,无法连接到。 所有的build议非常感谢。 谢谢

编辑 – 我看过类似的职位,一般的解决scheme没有侦听端口或防火墙。 我不认为在这里适用。

您正尝试访问端口3009上使用地址localhost监听的stream氓框上的应用程序。 为了这个工作,你需要正确设置端口转发,如在stream浪狗文档中提到的: https : //docs.vagrantup.com/v2/getting-started/networking.html

请检查并确保它已正确设置,并且http://localhost:3009上的请求被转发到无用的方框。 您还应该确保您的本地防火墙不阻止连接到端口。