EC2 内部插座
我试图让两个进程通过套接字连接进行通信。其中一个是 python 应用程序,另一个是 php 脚本。
我已经在我的家用计算机上创建并测试了客户端/服务器组合,并且它运行正常。但是,当我部署到 EC2 实例(ubuntu 10.10 64 位 ami + apache + php)上时,我从 php 脚本中收到无法连接到套接字错误(111 连接被拒绝)。 python 应用程序能够绑定到套接字并侦听消息,但 php 脚本无法发送消息。
我已经在亚马逊安全组中打开了所需的端口,我可以使用 telnet 从外部连接到该端口。但是,如果我尝试从服务器内部连接 telnet,我会收到相同的连接被拒绝错误。
我该如何解决这个问题?
编辑:两个进程都在同一个实例上
I'm trying to have two process communicate through a socket connection. One of these is a python app, and the other is a php script.
I've created and tested the client/server combination on my home computer and it functions properly. However, when I deploy onto an EC2 instance (ubuntu 10.10 64bit ami + apache + php) I get an unable to connect to socket error (111 Connection Refused) from the php script. The python app is able to bind to the socket and listen to messages but the php script is unable to send messages.
I've opened the required ports in the amazon security group and I can connect to the port externally using telnet. However if I attempt to connect with telnet from within the server I get the same connection refused error.
How can I solve this issue?
Edit: Both processes are on the same instance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题与 EC2 明确无关。我没有绑定到本地主机,而是绑定到我的主机名。在与我的本地主机 IP 相同的本地网络上,但在 ec2 上却不是。切换到绑定到本地主机解决了这个问题。
The issue had nothing to do with EC2 explicitly. I was not binding to localhost, but instead binding to my hostname. On a local network that was the same as my localhost ip, however on ec2 it was not. Switching to binding to localhost fixed the issue.