9

I created an HTML document that will display that the server is not ready yet, and then redirect to another page. I want this to be the 503 error page.

What file do I need to edit in Apache to get this custom HTML to be my new 503 error page? I have tried following the instructions on multiple websites, but it still points to the original Apache one.

This is the code that I have in my "httpd-vhosts.conf" file.

<VirtualHost *:80>
ServerAdmin blah@blah.com
ServerName blah.blah.com
ServerAlias blah blah.blah.local
ErrorLog "logs/blah-error.log"
CustomLog "logs/blah-access.log" common
ErrorDocument 503 "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah/error.html"
LogLevel warn
RewriteEngine On
JkMount /* worker5
DocumentRoot "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah"
<Directory "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/blah">
            Options All
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

In the "httpd.conf" file, it is including the "httpd-vhosts.conf" file, so I don't know why it is not working. Any help would be appreciated. Thanks.

snowfi6916
  • 697
  • 4
  • 9
  • 21

1 Answers1

5

ErrorDocument takes in a absolute URL path instead of a file path. So it should be:

ErrorDocument 503 /blah/error.html

Assuming under your document root is a /blah/error.html file.

Welsh
  • 5,138
  • 3
  • 29
  • 43
  • It will not work this way because some errors code have to be configured from: /etc/apache2/conf.d/localized-error-pages – moderns Apr 28 '14 at 22:24
  • 1
    No it doesn't. You can do ErrorDocuments in various contexts. See: http://httpd.apache.org/docs/2.2/mod/core.html#errordocument – Welsh May 03 '14 at 17:54
  • This answer doesn't make sense. 503 is shown when the site is down...but you're suggesting you add this to your site...which won't be shown when the site's down? – Cerin Mar 06 '18 at 21:45
  • 3
    If you are using Apache HTTP with a ProxyPass to display for example a NodeJS site, you can use this to return a custom, friendlier 503 instead of the default white screen if the upstream becomes unavailable. – Welsh Mar 07 '18 at 22:46