I am running two websites through a VPS using apache virtualhost. The first website is working, when i try to access the second website on firefox or chrome i keep getting the error The connection has timed out.

I added the following line to my iptables:

-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

and port 80 was open yesterday and today is says it is closed. Either way my first website still works so i am not sure if this is the problem.

My iptables config is:

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2234 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT

When I run the dig command it correctly points the A record to my VPS ip address.
What could be the problem here? I can't see what i am doing wrong.

Update: I tried hashing as recommended, that did not work. How can I check to see port 80 is open for both sites? I thought once port 80 is open, anything can connect to it?


you have defined port 80 twice with two different rule-sets? there could be a conflict due to this? can you check by hashing one of them?

| improve this answer | |
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – kasperd Jan 15 '17 at 19:48
  • thanks for the reply. So I tried each rule individually and then together, neither works. I included both lines so when you read this you will know what i am talking about. What gets me is one website works and the other won't? (-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT ) (-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT) Can you please tell me what you mean by hashing? again i am new to this. thanks. – learning it Jan 15 '17 at 20:09
  • Do both sites point to port 80? – kalyan Jan 16 '17 at 4:24
  • @kasperd i did not have the reputation to comment :-) thats why i had to drop it as an answer. – Corleone Jan 16 '17 at 15:06
  • 1
    Please edit your question to include the additional information posted in these comments. – Tim Jan 16 '17 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.