Compiling Nginx on production. How to do it without down time.

Francis Daly francis at
Sat Oct 13 12:51:44 UTC 2012

On Fri, Oct 12, 2012 at 08:25:36PM -0400, Bob S. wrote:

Hi there,

> I don't see how this can work.

And yet, it does.

> Trying to replace the nginx executable with a new version of nginx, while
> nginx is running,  will produce:
> cp: cannot create regular file `nginx': Text file busy

I've never seen that error message.

That's not to say that it doesn't happen; but that it is by no means

> Or am I missing something?

It is possible to move, remove, rewrite, or replace a file, independent
of whether it is being used by another process.

> This is standard behavior on any running executable in Linux.

I'd suggest that your Linux is not the same as my Linux.

"standard behavior" is that "file being used" does not block "file
being modified".

All that said, if what "make install" does by default is not what you
want, you can always "cp" or "mv" the old executable; then "cp", "mv",
"cat", or otherwise, put the new executable in place.

And then send the special nginx signals to ensure upgrade with zero

(And it is possible that your system init script does exactly this.)

All the best,

Francis Daly        francis at

More information about the nginx mailing list