Sunday, March 29, 2015

apache 2.2 - Why can my servers not access their own addresses?




I have two VMs on CentOS 6.5, running Plesk 12, and the webserver is Apache 2.2. One is a clone of the other, and I inherited them setup by someone else. My problem is that I can access my sites hosted on the servers from any computer other than these servers themselves.



Say example.com points to one of my servers. If I am SSH'd into either of the servers and run
wget example.com I will get back:



--2014-10-20 18:01:42--  http://example.com/ Resolving example.com... 
Connecting to example.com||:80... failed:

Connection timed out. Retrying.


The IP address it resolves to is correct. If I run wget on the servers using the IP address directly I have the same result negative result.



If I run wget to the same domain on a computer outside these VMs I resolve to the same correct IP, and I am connected. Using localhost on the VMs does work fine:



wget localhost
--2014-10-20 18:12:35-- http://localhost/
Resolving localhost... 127.0.0.1

Connecting to localhost|127.0.0.1|:80... connected.


The problem seems to be that the servers don't know what to do when they get to the IP address, and I'm at the end of my knowledge in this area. Any direction on this is appreciated!


Answer



You need a route which directs the traffic to your local interface, and you may have a firewall issue.



Add the output of netstat -an for routing. It's likely to be ipchains -L or iptables -L to list the firewall rules.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...