Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a development server and I would like to configure Apache so that when a 500 http code is generated it will display the error directly in the response (i.e. what would be printed to /var/log/httpd/error_log is displayed to the user).

However, I cannot figure out where this directive is.

Any help?

share|improve this question

I believe the directive you are looking for is ErrorDocument (documented here). For example:

<VirtualHost *:80>

    ErrorDocument 500 /error/500.html

On a second read-through of your question it appears you may be asking for Apache to display the error directly in the browser (i.e. what would appear in /var/log/httpd/error_log). Can you clarify?

share|improve this answer
Hi. Your second guess is the one I am interested in. I want it to print the error to the browser, not a custom error page. Thanks – Thomas Feb 21 '12 at 14:44
It is amazing how a seemingly easy question, has no responses. – Thomas Feb 21 '12 at 15:59
This isn't seemingly easy as it represents a complex change in how Apache normally handles these errors. I can appreciate how frustrating it can be to not get immediate assistance from volunteers during their work day... – Kyle Smith Feb 21 '12 at 16:04
@Thomas As far as I'm aware there's no way to do this without putting it together yourself with dynamic code in a custom 500 handler page. I can't blame Apache for not building it in, either - having this on a production web server would be reckless information disclosure, while using it for debugging seems pointless since the error log is easily tail-able. – Shane Madden Feb 21 '12 at 16:28
OK guys. Thanks. @Kyle. I was not being cynical. It was just an observation – Thomas Feb 21 '12 at 16:49

Set up Apache to use server-side includes (.shtml files) and configure a custom error page as above (though naturally pointing to an .shtml file), and in that custom error page use something like this:

<p>The requested page, <code>
<!--#echo var="REQUEST_URI" --></code>,
 does not work properly.</p>

<p>Click <a href='<!--#echo var="HTTP_REFERER" -->'>here</a> to return from whence you came.</p>

<legend>Error Message</legend>
<!--#echo var="REDIRECT_ERROR_NOTES" -->

<!--#echo var="HTTP_USER_AGENT" -->
<!--#echo var="REDIRECT_STATUS" -->
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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