Apache
Shared Hosting
Shared hosting accounts can set the custom error pages for each domain in the members section here.
Dedicated Servers
Apache 2.2 documentation on error pages can be found here.
Apache 2.4 documentation on error pages can be found here
Tomcat
Error pages are defined in $CATALINA_HOME/conf/web.xml . If you have a multi instance install this can also be set in $CATALINA_BASE/conf/web.xml. Error pages can also be set on a an application level.
Tomcat versions before Tomcat 7 need to define a page for each response code like follows.
<error-page> <!-- Missing login --> <error-code>401</error-code> <location>/401.html</location> </error-page> <error-page> <!-- Forbidden directory listing --> <error-code>403</error-code> <location>/403.html</location> </error-page> <error-page> <!-- Missing resource --> <error-code>404</error-code> <location>/404.html</location> </error-page> <error-page> <!-- Uncaught exception --> <error-code>500</error-code> <location>/500.html</location> </error-page> <error-page> <!-- Unsupported servlet method --> <error-code>503</error-code> <location>/503.html</location> </error-page>
Starting with Tomcat 7 (Servlet 3.0) you can specify a catch-all error if desired.
<error-page> <location>/generic-error.html</location> </error-page>