title: How to Debug Localhost - This Site Can't Be Reached
body: <p>I setup LAMP on my MacOS computer using the <a href="https://getgrav.org/blog/macos-mojave-apache-upgrade-homebrew" rel="nofollow noreferrer">https://getgrav.org/blog/macos-mojave-apache-upgrade-homebrew</a> tutorial series.</p>
  
  <p>It works for a month or two and then suddenly (without any changes made to config) it will stop working.</p>
  
  <pre><code>This site can’t be reached
  localhost refused to connect.
  ERR_CONNECTION_REFUSED
  </code></pre>
  
  <p>The last time this happened I gave up and re-installed from scratch. I don't want to have to do this each time it stops working.</p>
  
  <p>Here is what I've tried so far this time:</p>
  
  <pre><code>jackrobson$ ps -aef | grep httpd
    501 84635   459   0  5:03pm ttys000    0:00.00 grep httpd
  jackrobson$ sudo apachectl -k restart
  jackrobson$ tail -f /usr/local/var/log/httpd/error_log
  [Sun Sep 16 14:43:22.548017 2018] [mpm_prefork:notice] [pid 74] AH00173: SIGHUP received.  Attempting to restart
  [Sun Sep 16 14:43:22.635379 2018] [mpm_prefork:notice] [pid 74] AH00163: Apache/2.4.34 (Unix) PHP/7.0.31 configured -- resuming normal operations
  [Sun Sep 16 14:43:22.635437 2018] [core:notice] [pid 74] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
  </code></pre>
  
  <p>My /usr/local/etc/httpd/extra/httpd-vhosts.conf looks like:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      DocumentRoot "/Users/jackrobson/Projects"
      ServerName localhost
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>As you can see, the last error was over two weeks ago. No errors today even though I'm getting the ERR_CONNECTION_REFUSED error.</p>
  
  <p>Any suggestions will be greatly appreciated.</p>