I have an Apache2, sitting in front of Tomcat7 via ajp, all on Ubuntu. What I want to do is serve a simple static page with Apache when I perform maintenance.
I found this nice tutorial, but I am not that firm on Apache.
ServerName localhost
DocumentRoot /var/www/maintenance
##For maintenancepage
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !/maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
#Directory settings omitted..
ProxyPass /maintenance.html !
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
This is my virtual host configuration file in /sites-available/
I expected: when creating a file maintenance.enable
in var/www/maintenance
, all requests are answered with the maintenance.html
page.
But sadly, nothing ever happens. Is my DocumentRoot wrong? Is my ProxyPass setting wrong?
/var/www/maintenance/maintenance.html
and can you access it directly athttp://example.com/maintenance.html
?