Hasan Setiawan

Write, write, write give your wings on code!

Follow me on GitHub

Apache Troubleshooting Tips

When running Apache sometime we got problem. For example if you get a message that the browser can't connect to the server, first check to ensure the server is up. By run this command:

ps -aef | grep httpd

You should see a few httpd processes if Apache is up and running.

You didn't see any process, Try to restart Apache with:

sudo apachectl -k restart

You can also see the error log, with this command:

tail -f /usr/local/var/log/apache2/error_log

If that doesn't work, check to ensure you have Listen: 80 in your /usr/local/etc/apache2/2.4/httpd.conf configuration file.

You also can controll Apache with apachectl command:

  
$ sudo apachectl start
$ sudo apachectl stop

//The -k will force a restart immediately rather than asking politely to restart when apache is good and ready
$ sudo apachectl -k restart