Apache not accepting incoming connections on CentOS 7 VPS
Quick tip for anyone struggling with Apache on CentOS 7.
After fresh install of Apache I couldn’t connect to port 80. However I could access web server from terminal without any problem (wget localhost).
Let’s troubleshoot the issue.
Then I checked DNS and httpd.conf and it wasn’t the case. After some googling I’ve found this tip to check iptables.
We see that iptables say:
It only allows connections already established by server and not by remote machines.
Then we see exceptions, in this case it’s for ssh:
We need to add the same rule for port 80:
We can do it like this:
This adds new rule to the 4th line.
Don’t forget to save the file, otherwise changes would be lost after reboot:
It should work now!