Multiple Maintenance Pages

Davy Campano dcampano at
Tue Jun 17 04:40:00 MSD 2008

I've looked around for this but haven't come across the answer.  I am
wondering if it is possible to have a maintenance page be displayed for one
subdirectory but not the other.

I have 2 apps on same machine with a root of /public_html/
App 1 is /public_html/app1/
App 2 is /public_html/app2/

I want the maintenance page to be shown for app 1 only when it exists in the
app 1 subdirectory.

This looks like it would show it for both applications:

if (-f $document_root/system/maintenance.html) {
  rewrite  ^(.*)$  /system/maintenance.html last;

Is there a way to rewrite only the requests for a certain directory without
making manual changes like this:

if (-f $document_root/app1/maintenance.html) {
  rewrite  ^(.*)$  /app1/maintenance.html last;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list