0

I've looked at Apache ErrorDocument directive on how to do this. I found an answer here and it mentioned :

You should use a URL to point to your ErrorDocument otherwise if you use a filesystem reference you will get an additional 503 whilst trying to find it.

So here's how my virtualhost looks like. For test purpose i'm pointing it at Google

<VirtualHost *:80> ServerName shabbasheep.mydomain.com ServerAlias www.mydomain.com ErrorDocument 503 https://www.google.com ... ... </VirtualHost> 

I'm trying to show a maintenance page when my apache server goes down. I'm currently testing this on my local machine before applying it on the live server.

To Test this I stop my apache server and try to access my page hoping the page gets re-directed to the Google Page.

It goes not work :| and I get Firefox can't establish a connection to the server at shabbasheep.mydomain.com.

After doing some further re-search I found a solution that uses RewriteEngine so i went along and added the following to my virtual host.

RewriteEngine On RewriteCond %{REQUEST_URI} $ RewriteRule $ /https://www.google.com [R=503,L] 

Still no luck of redirecting to Google when my server is down. Excuse my understanding on this subject.

Any help on how to solve this is much appreciated.

Thanks in advance

7
  • 6
    I think you misunderstand the concept a bit. Apache shows a (custom) error page when it encounters an error, but to be able to do that it still needs to be running. If Apache isn't running it can't do anything and the connection the visitor is making to your server will time-out and fail. Commented Aug 6, 2014 at 10:56
  • @HBruijn is correct. Basically Apache listen on port 80. But if you stop Apache, no one is listening on port 80. So when a request arrives on this port, your Operating System is simply rejecting it as no service is listening. Commented Aug 6, 2014 at 10:58
  • Thanks a lot for enlightening me on this. I did wonder how it was going to work when apache was down, but was not very clear on it. I was assuming apache had something hidden that performs this. So there is no possible way of doing this? Commented Aug 6, 2014 at 11:01
  • 1
    Larger sites typically have a loadbalancer, which during normal operations simply forwards all requests and lets the actual web server(s) handle them. During an outage or scheduled maintenance when none of the actual web servers are available, the loadbalancer, as an outside source, can often display a simple static page with a notification instead. Commented Aug 6, 2014 at 11:05
  • 1
    Take a look at what for instance cloudflare offers in this regard Commented Aug 6, 2014 at 12:39

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.