Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616120
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:56:12+00:00 2026-05-22T01:56:12+00:00

To show maintenance page during deploy I’ve always used next config in nginx: if

  • 0

To show maintenance page during deploy I’ve always used next config in nginx:

if (-f /home/shared/system/maintenance.html) {
    return 503;
}

error_page 503 @maintenance;

location @maintenance {
    root /home/shared/errors;
    rewrite ^(.*)$ /maintenance.html break;
}

And everything was ok until I needed to add static content to maintenance page (images, stylesheets, etc.)

No of static content work with such logs in error.log:

2011/05/05 02:47:20 [notice] 13760#0: *6 "^(.*)$" matches "/some.jpg", client: x.x.x.x, server: server.com, request: "GET /some.jpg HTTP/1.1", host: "server.com"
2011/05/05 02:47:20 [notice] 13760#0: *6 rewritten data: "/maintenance.html", args: "", client: x.x.x.x, server: server.com, request: "GET /some.jpg 2 HTTP/1.1", host: "server.com"

Which is logical – if I do rewrite everything to maintenance.html that means that static content is not exclusion.

But I cannot find any proper solution to make redirect to every file except that ones which are physically existed in root /home/shared/errors folder.

PS. /home/shared/errors does not share any resources with common project folder – this is completely separate folder (even without any symlinks to /current for the project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:56:13+00:00Added an answer on May 22, 2026 at 1:56 am

    I’m sorry, Frank Farmer, but this doesn’t work.

    What works but not so neat:

    And how requests work ->

    1. I use rule #1

      if (-f /home/shared/system/maintenance.html) {
          return 503;
      }
      

      this rule has a support of named location location @maintenance and for the common redirect to /maintenance.html at root /home/shared/errors everything works.

    2. this page contains and image some.jpg – to receive this image browser starts new request and this new request again hits rule #1

      all of this was described in initial question BUT

      if I use some if magic like in Frank Farmer’s answers I can point server to requested file BUT HTTP answer will be 503 and browsers (all, except Safari, in my test) throws errors in debug console and do show image but do not process CSS-files in the same situation.

      And this is critical.

    3. I tried to resolve this using location magic for my new content-requests – that means that I have to:

      1. do NOT return 503 for content requests and skip named location at all.

      2. do change root /home/shared/errors because maintenance content is still there.

    4. Finally, I’ve got next solution:

      1. create maintenance-static folder for all static content and change paths in my maintenance.html file and maintenance-static stylesheets

      2. next use these rules (I believe they are self-descriptive) which replace single if (-f /home/shared/system/maintenance.html) in initial question:

        set $can503 0;
        if (-f /home/shared/system/maintenance.html) {
            set $can503 1;
        }
        if ($uri ~* /maintenance-static/) {
            set $can503 0;
        }
        location /maintenance-static/ {
            root /home/shared/errors;
        }
        if ($can503 = 1) {
           return 503;
        }
        

    This solution works without any errors in all browsers and for numerous of pages in shared/errors folder, for ex. maintenance.html, error.html, overload.html, etc.

    This solution is not really clear – probably you can hint me how I can make it neater, but remembering we are dealing with separate requests (and separate nginx processes for each file/request in case of high load, etc.) for initial html and its content we cannot use same rule with 503 redirecting for all files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show a custom site under maintenance page. But how can i
On my PHP site I would like to sometimes show a maintenance page to
I have to implement ability to show site is under construction page during doing
i want to show all the vehicle maintenance history when user click on the
inside show.js.erb $('#viewport').html(<%= escape_javascript(render('show')) %>); I am trying to render the show view into
Please show me how i should correctly execute system proccess in java. I would
YQL SHOW TABLES has CSV and HTML. What about a table for Apache access
Can someone show me some html to layout the following not using tables? ______________________________________
I'm considering using the following code during a website launch phase to show users
I'm trying to implement something like Mark Story's Down for Maintenance page using CakePHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.