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

We have a service configured that must go down once a week for maintenance as it is dependent on the ERP system which goes down. I'm wondering if it's possible for Apache to stop forwarding requests to Tomcat and instead serve up static content?

I imagine I could achieve this by setting up a cron job to a2enable-site and a2disable-site respectively by having a static site that gets switched out for the proxy site though I was wondering if there was a different approach I could use.

-Brett

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

mod_rewrite can do rules based on the current time. Something like this untested snippet might just work:

RewriteCond %{TIME_WDAY} 1
RewriteCond %{TIME_HOUR} 5
RewriteRule .* /sorry.html [L,R]
share|improve this answer
    
Dennis, this looks like exactly what I'm after. I'll have to do some experimenting, though the mod_rewrite documentation seems to suggest this is something I can do. Since every request would go through the rewrite rule, would this have any noticeable affect on performance? –  Brett Ryan Nov 18 '12 at 14:32
    
That depends on your rule. Something as simple as the above shouldn't be noticeable. –  Dennis Kaarsemaker Nov 18 '12 at 14:34
add comment

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.