EC2 internal jacks

I am trying to bind two processes through a socket connection. One is a python application and the other is a php script.

I created and tested the client / server combination on my home computer and it works correctly. However, when I deploy an EC2 instance (ubuntu 10.10 64bit ami + apache + php), I get the inability to connect to the socket error (111 Connection Refused) from the php script. A python application can bind to a socket and listen for messages, but a PHP script cannot send messages.

I have opened the required ports in the amazon security group, and I can connect to the port from the outside using telnet. However, if I try to connect to telnet from the server, I get the same message as the failure error.

How can I solve this problem?

Edit: both processes are in the same instance

+3
source share
1 answer

The problem has nothing to do with EC2. I did not bind to localhost, but instead bind to my hostname. On a local network that was the same as my localhost ip, however on ec2 this is not the case. Switching to binding to localhost fixed the problem.

+1
source

Source: https://habr.com/ru/post/1795141/


All Articles