packetie packetie - 1 month ago 9
Apache Configuration Question

Couldn't access CentOS httpd

I have been using Ubuntu, just recently started to work on Centos (CentOS Linux release 7.1.1503 (Core)) running in VMplayer on my desktop (Ubuntu).


  • Branch new CentOS installation.

  • installed httpd (using "yum")

  • for some reason, httpd didn't start automatically, I ran "service httpd start" and it started according to "netstat -antp".

    [root@localhost ~]# netstat -antp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1161/sshd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1620/master
    tcp 0 0 10.0.0.19:22 10.0.0.7:20383 ESTABLISHED 2421/sshd: root@pts
    tcp6 0 0 :::80 :::* LISTEN 2453/httpd
    tcp6 0 0 :::22 :::* LISTEN 1161/sshd
    tcp6 0 0 ::1:25 :::* LISTEN 1620/master

  • I can access the http server locally (
    curl http://localhost
    within the CentOs command line)

  • when I tried access httpd from the host
    curl http://172.16.13.143/
    , it refused the TCP connection. I was able to to ssh into it, it works ok for ssh
    ssh root@172.16.13.143
    .

  • I have stopped iptables
    service iptables stop

  • SELinux is turned off according to
    getenforce
    command.



I just need to do a quick test on the web interface but I can't. Really need some help. Thanks.

Answer

Packages installed on RHEL/CentOS/Fedora systems aren't supposed to start any services automatically (because maybe you're not ready to expose your service to the world until after you've configured it).

Running service httpd start will start the service temporarily, but it won't start next time you boot. You want systemctl enable httpd to enable the service to start automatically when you boot your system.

You could check if the firewall is actually disabled. Run iptables -S to see the current ruleset. The default iptables configuration typically allows only ssh and nothing else.

Update

Your system is probably running firewalld to manage the firewall. Try service firewalld stop.

You can run systemctl disable firewalld to prevent it from starting next time your system boots.