Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have some virtual hosts which are redirections to Zope server processes:

RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/theroot/VirtualHostRoot/$1 [L,P]

Of course, if the Zope process is not running, the redirection fails. This can happen during restart of the instance (e.g. for an update), or for development/testing instances which are not supposed to run all the time. I'd like to have a friendly message in this case.

Thus, for the sole purpose of error handling, I defined a DocumentRoot:

DocumentRoot /var/zope-instances/my-instance/htdocs
ErrorDocument 500 /error-500.html
ErrorDocument 503 /error-500.html

Unfortunately it won't work; when trying a page while Zope is down, Apache tells me:

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Temporarily Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

The error documents are world-readable; the directories are world-executable.

What can I do to get the error page running? Is there something special to consider because of mod_rewrite?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I finally found the solution (at this page); indeed, the problem was related to rewriting. I modified my virtual host like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/error-50[0-3].html$
RewriteRule ^/(.*) http://localhost:8080/...

(in my case, I get a status 503 when Zope is down; my condition is ready for more specific messages as well).

Since Apache didn't need to serve static content up to this point, I needed to enable the mime module; in my case:

cd /etc/apache2/mods-enabled
ln -s ../mods-available/mime.load .
share|improve this answer
add comment

Your Answer

 
discard

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.