I'm using tomcat6 with mod_jk setup(both running at port 80) on ubuntu9.10 and 8.10 servers. I deploy war files under /usr/share/tomcat/webapps. During deployment, as I restart the tomcat, I will get the following page when the tomcat application is accessed on the browser:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.11 (Ubuntu) mod_jk/1.2.15 Server at 192.168.2.54 Port 80
How could I redirect this page to some other self created maintenance page while the tomcat server is down?.
You can setup custom error page in Apache for error code 503.
http://httpd.apache.org/docs/2.2/mod/core.html#errordocument
If you're using mod_jk and tomcat connectors this is expected behavior. If you use something like
you will see 'foo' rendered on the page or
which will direct you to somedomain.com successfully. But if you use something like
Apache won't be able to find [DocumentRoot]/maintenance.html since it's looking within the context of the tomcat connector. You need to unmount your connector and tell Apache to serve static content from another location.
This is a good guide to get you started with mod_jk. Custom Error Pages with Apache and Tomcat Connectors
edit: Here's the solution I employed to get our custom 503 pages to render properly.
First, all of our custom error pages are prefixed with the error code since it's likely our web app won't contain files with these status codes as the root of the file name. So for using your example, I would have something like the following three files in a directory called 'custom_errors':
This makes it easy to exclude any files related to custom error pages from the jk mount. In our vhost file, then we set the error document location and alias
This basically tells Apache and mod_jk not to mount any files with the 503 prefix under the context of the tomcat connector and will look locally for those files instead. If you don't want to use a location relative to DocumentRoot, you can use and Alias like I did.