Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to set all virtualhosts on my server down for maintenance for some time.

The temporary page should contain something like

sorry, the page www.xxx.com is down for maintenance. you can see the cached version here:

Then the trick: the user should then see the cached page from a cache like googlecache or similar for the requested page as long as the server is down.

This would show the correct content on pages, that are static anyway and give the visitor the needed content in many cases, while I can shut down mysql and other services that would usually be needed to show that pages.

How can I set a global page on all virtualhosts, that parses the original requested URL through PHP?

share|improve this question
1  
why do you want to pollute the internet with SEO keywords? –  pQd Nov 2 '12 at 8:44
    
not pollute, I just want to show some content –  rubo77 Nov 2 '12 at 9:35
    
SEO surely sounds like polluting/vandalism. –  pQd Nov 2 '12 at 9:36
    
oy, I changed the title –  rubo77 Nov 2 '12 at 9:36

1 Answer 1

up vote 0 down vote accepted

A solution with javascript:

create a page called

offline.html

HTTP/1.0 200
Content-Type: text/html; charset=utf-8

<html><body>
sorry, the site is currently down for maintenance.<br>
<SCRIPT>
document.write('<iframe src="http://webcache.googleusercontent.com/search?q=cache:'
        +location.href
        +'" style="width:100%;height:95%"></iframe>');
</SCRIPT></body></html>

and set up a temporary server with

$ apt-get install ucspi-tcp
$ tcpserver 0.0.0.0 80 sh -c 'awk "/^\r*$/ { exit }"; cat offline.html'

but it seems google doesen't allow such a link in an iframe, so another cache will be needed.

sources:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.