Not a duplicate, please be patient while trying to flag as duplicate. Thanks.
Environment:
- Mac OS X EL Capitan 64 bit
- Apache 2.4.25 (Unix)
ping
ping 127.0.0.1
returns:
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.081 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.111 ms
…
telnet:
telnet 127.0.0.1 80
returns:
Trying 127.0.0.1…
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
scutil:
scutil -r localhost
returns:
Reachable
configtest:
apachectl configtest
returns:
Syntax OK
$PATH
/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/sbin
Several apachectl restart
s & Complete system restarts with no success!
What is the problem with my Apache installation?
Update 1
curl
curl -v http://127.0.0.1
returns:
Rebuilt URL to: http://127.0.0.1/
Trying 127.0.0.1…
connect to 127.0.0.1 port 80 failed: Connection refused
Failed to connect to 127.0.0.1 port 80: Connection refused
Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
Update 2
lsof
lsof -i:80
returns:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 349 peyman 126u IPv4 0x23528848eb5fe4db 0t0 TCP 192.168.1.102:49238->ec2-54-197-238-119.compute-1.amazonaws.com:http (ESTABLISHED)
Google 349 peyman 147u IPv4 0x23528848ec35769b 0t0 TCP 192.168.1.102:49286->151.101.193.69:http (ESTABLISHED)
Google 349 peyman 164u IPv4 0x23528848ebfa413b 0t0 TCP 192.168.1.102:49290->ec2-23-23-98-233.compute-1.amazonaws.com:http (ESTABLISHED)
Google 349 peyman 170u IPv4 0x23528848ebfa031b 0t0 TCP 192.168.1.102:49242->pixel.quantserve.com:http (ESTABLISHED)
Google 349 peyman 188u IPv4 0x23528848ec330dbb 0t0 TCP 192.168.1.102:49248->151.101.65.69:http (ESTABLISHED)
Google 349 peyman 189u IPv4 0x23528848ebe7185b 0t0 TCP 192.168.1.102:49308->ec2-23-21-110-0.compute-1.amazonaws.com:http (ESTABLISHED)
Google 349 peyman 208u IPv4 0x23528848ec35885b 0t0 TCP 192.168.1.102:49272->a72-247-178-186.deploy.akamaitechnologies.com:http (ESTABLISHED)
Best Answer
I don't see any evidence in what you've posted of Apache even listening on port 80; I only see outbound connectivity to port 80 on other systems. The
telnet 127.0.0.1 80
command doesn't show Apache is reachable; you would see the same results if you used port 81, 85, 800, etc. Issue the commandnetstat -a | grep http | grep LISTEN
; you should see a line with "*.http" and "LISTEN" at the end of the line, if Apache is actually listening for connections on port 80. E.g., see Running an Apache web server under OS X El Capitan.If you don't see a line of output indicating it is listening on port 80, but are merely returned to the Bash shell prompt, then issue the command
sudo apachectl start
then issue the netstat command again. If you now see that a process is listening on port 80, you can then try your telnet command again. If Apache is responding on port 80, you should then seeEscape character is '^]'.
At that point you can issue the commandHEAD / HTTP/1.0
and then hit enter a couple of times. You should see Apache respond with output similar to the following output: