2

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 restarts & 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)

migrated from serverfault.com Mar 11 '17 at 0:06

This question came from our site for system and network administrators.

  • What do you get with curl -v http://127.0.0.1/ and what is in the error logs? – Aaron Mar 10 '17 at 22:46
  • Please check Update 1 – Trix Mar 10 '17 at 23:02
0

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 command netstat -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 see Escape character is '^]'. At that point you can issue the command HEAD / HTTP/1.0 and then hit enter a couple of times. You should see Apache respond with output similar to the following output:

$ telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Sat, 11 Mar 2017 01:44:13 GMT
Server: Apache/2.4.18 (Unix) PHP/5.5.38
Last-Modified: Fri, 03 Feb 2017 21:44:57 GMT
ETag: "a8-547a7315f6840"
Accept-Ranges: bytes
Content-Length: 168
Connection: close
Content-Type: text/html
  • Thanks but I ended up with whole system setup from the beginning, as That was really annoying – Trix Mar 12 '17 at 6:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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