How to fix Apache 2 500 internal server error

July 17, 2017

Utilizing expires headers is an important part of optimizing your website. At times it can be tricky. Apache2 configuration syntax is extremely particular. I've gathered a few items to check when you've experienced this issue.

1. Server logs

When troubleshooting anything with Apache 2, your first step should be checking the apache error log. The Apache logs will let you know everything that is going on with your web server.

The location is

/var/log/apache2/

2. Verify your modules are available

Within your default configuration file [code]/etc/apache2/sites-available[/code] or your .htaccess files. There may be references to an Apache module that does not exist.

[alert type="info"]

Example:

You may be familiar with this code in .htaccess [code]<IfModule mod_rewrite.c>[/code]. This is a if statement that will ignore any trailing directives before the closing tag. This will prevent Apache from crashing if the module is not present. Many will add a .htaccess directive without the if statement resulting in a crash if the module isn't there.

[/alert]

3. Verify your Apache config files are correct

Apache has a few files you should be checking.

apache2.conf which is located at [code]/etc/apache2[/code]

envvars configuration file which is located in the same place

Your configuration files located in [code]/etc/apache2/sites-available[/code]

[alert type=" info"] If you're not sure which one is available, you can run [code]apachectl -S[/code] on the command line[/alert]

That's about all I can think of when I troubleshoot Apache issues. Keep in mind, when troubleshooting Apache 2, your error logs are your best friend. If I'm missing something please let me know.

Copyright © Mage H.D. Inc.
envelopephonemap-marker linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram