1

I am running CentOS 7 in an ESXi VM. I have disabled iptables and selinux. And I am simply trying to run Apache on this version of CentOS 7, which I think is working fine:

[root@am1 etc]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since Mon 2015-12-14 11:17:31 EST; 2h 7min ago
  Process: 16028 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 16033 (/usr/sbin/httpd)
   Status: "Total requests: 3; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─16033 /usr/sbin/httpd -DFOREGROUND
           ├─16034 /usr/sbin/httpd -DFOREGROUND
           ├─16035 /usr/sbin/httpd -DFOREGROUND
           ├─16036 /usr/sbin/httpd -DFOREGROUND
           ├─16037 /usr/sbin/httpd -DFOREGROUND
           ├─16038 /usr/sbin/httpd -DFOREGROUND
           └─16039 /usr/sbin/httpd -DFOREGROUND

Dec 14 11:17:31 am1 systemd[1]: Started The Apache HTTP Server.
[root@am1 etc]#

The instance of CentOS answers ping, allows connections using ssh, but does not answer any web requests even though it is listening on port 80.

[root@am1 etc]# netstat -anp |grep httpd
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      16033/httpd         
tcp6       0      0 :::443                  :::*                    LISTEN      16033/httpd         
unix  3      [ ]         STREAM     CONNECTED     117080   16033/httpd

On the localhost at command line, wget responds:

[root@am1 etc]# wget http://127.0.0.1/ -O /dev/null
--2015-12-14 11:24:26--  http://127.0.0.1/
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-12-14 11:24:26 ERROR 403: Forbidden.

[root@am1 etc]# 

However, from another machine, Firefox (the same Firefox session I'm using to write this question) returns this error:

Firefox can't establish a connection to the server at x.x.x.x

Firefox can see other machines on the local network on port 80. The only difference on this CentOS installation is that I'm running it in an ESXi VM.

Is there anything I need to configure on the ESXi server to allow port 80 traffic? Since the system answers ping and allows connections using SSH, I do not know why port 80 does not answer across the network. Again, other systems on this same network answer on port 80 without issues.

Anyone else have this problem? (Or better, a solution?)

Chopper3
  • 101,299
  • 9
  • 108
  • 239
  • Have you checked your firewall making sure that http (80) is enabled? By default on CentOS 7 80 is disabled. – Steve Butler Dec 14 '15 at 18:34
  • yes, the firewall is allowing port 80 traffic in the network. Other web services are answering just fine. Just this installation of Apache on CentOS in the VMware container is the problem. – Gene Brotherton Dec 14 '15 at 18:36
  • Do you get a Timeout error or just Connection reset error in browser?. – serverliving.com Dec 14 '15 at 18:37
  • @Steve, I didn't catch your edited comment in time. I have disabled iptables, but is there another way to enable port 80? – Gene Brotherton Dec 14 '15 at 18:37
  • Try this iptables rule & see if it fixes the issue --> iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT Also do a restart of iptables . If it's iptables related issue, you should get a timeout error – serverliving.com Dec 14 '15 at 18:41
  • @SteveButler your solution worked! Thanks so much for the hint. I'm very used to Red Hat 6. This is actually what I did (http://stackoverflow.com/questions/24729024/centos-7-open-firewall-port) – Gene Brotherton Dec 14 '15 at 18:47

1 Answers1

0

Thanks to @SteveButler for his comment / answer. Port 80 is disabled by default in CentOS 7.

I found this on Stackoverflow and my problem is resolved:

https://stackoverflow.com/questions/24729024/centos-7-open-firewall-port