Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I need to regenerate my website. I do not want my users to see semi-generated site. I also do not want google to see 404 errors.

The best solution is to return "503" for while I my system generates new files. Is not it?

So I want my system to put special "lock" file before generating content and to remove it after it.

And I put onto my server config:

if (-f $document_root/lock ) { return 503; }

Is my solution OK or is it bad? If so, what is the best solution? Probably I can configure nginx to establish TCP connection to my system (permanent connection) and to show 503 in case of connection is unavailable? That should be better because we would not need to check filesystem each time.


share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.