I've apache2 and tomcat6 both running on port 80 with mod_jk setup on ubutnu servers. I had to setup an error document 503 ErrorDocument 503 /maintenance.html
in the apache configuration and somehow I managed to get it work and the error page is server by apache when tomcat is stopped. Developers created a good looking error page(an html page which calls css and jpg) and I'm asked to get this page served by apache when tomcat is down. When I tried with JkUnMount /*.css
in the virtual hosting, the actual tomcat jsp pages didn't work properly(lost the format) as the tomcat applications uses jsp, css, js, jpg and so on. I'm trying if it is possible to get .css and .jpg served by both apache and tomcat so that when the tomcat is down I'll get css and jpg serverd by apache and the proper error document is served. Anyone has any technique?
Here is my apache2 configuration:
vim /etc/apache2/apache2.conf
Alias / /var/www/
ErrorDocument 503 /maintenance.html
ErrorDocument 404 /maintenance.html
JkMount / myworker
JkMount /* myworker
JkMount /*.jsp myworker
JkUnMount /*.html myworker
<VirtualHost *:80>
ServerName station1.mydomain.com
DocumentRoot /usr/share/tomcat/webapps/myapps1
JkMount /* myworker
JkUnMount /*.html myworker
</VirtualHost>
<VirtualHost *:80>
ServerName station2.mydomain.com
DocumentRoot /usr/share/tomcat/webapps/myapps2
JkMount /* myworker
JkMount /*.html myworker
</VirtualHost>
Simply what I'm trying to do is, css and jpg should be served by apache when tomcat is stopped and when tomcat is started it should be served by tomcat not by apache.
Best Answer
If your maintenance page is not too complex I would suggest inlining the stylesheets into the document. This way, you will not have to bother with a complicated ruleset as you mentioned above and are still able to server a well-styled maintenance page. Of course this will not necessarily solve the problem with images, though.