Jim's Memory
Remind me about > Apache

Apache

Say you want to put your web server out of commission for awhile.  Assuming you have a friendly ErrorDocument directive in your Apache config, here's a simple Python handler that returns 503 Service Unavailable for any request:

def handler(req):
    return 503

Just two lines is all the script needs.  To install it, save it as 'always-return-503.py' in your Python site-packages directory, and put this in your Apache config:

<Location />
  SetHandler python-program
  PythonHandler always-return-503
</Location>

Comment out the Location block when the site's ready to come back up.

Submenu