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

bwellsnc bwellsnc at gmail.com
Sat Oct 13 04:50:47 UTC 2012


Since you are using CentOS, look into rebuilding the rpm against the src rpm.

http://nginx.org/packages/centos/6/SRPMS/

I took the src rpm and enabled the modules that I need and added the
modules that I wanted from the addons.  I then built the rpm and
created my own repo server inside my network to distribute it to my
internal servers.  When you build the RPM and install it, it will
restart nginx but that should only be a few seconds of downtime.

Brent


On Fri, Oct 12, 2012 at 8:25 PM, Bob S. <farseas at gmail.com> wrote:
> I don't see how this can work.
>
> 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
>
> Or am I missing something?
>
> This is standard behavior on any running executable in Linux.
>
>
>
> On Fri, Oct 12, 2012 at 5:27 PM, Francis Daly <francis at daoine.org> wrote:
>>
>> On Fri, Oct 12, 2012 at 01:29:14PM -0700, Quintin Par wrote:
>>
>> Hi there,
>>
>> > Thanks for this. This looks a bit complicated.
>> >
>> > I’d assume that “make install” will overwrite the executable and that
>> > will
>> > ensure everything. Or should I just go ahead and do service nginx
>> > restart
>>
>> "make install" will replace the binary. It won't run the new binary.
>>
>> After replacing the binary, you'll want to do something like
>>
>>   kill -USR2 $(cat logs/nginx.pid)
>>
>> And after testing that things are working as expected, then
>>
>>   kill -WINCH $(cat logs/nginx.pid.oldbin)
>>
>> followed eventually by
>>
>>   kill -QUIT $(cat logs/nginx.pid.oldbin)
>>
>> The "control.html" page has more details about how to handle problems.
>>
>> "service nginx restart" probably doesn't do that sequence, and so probably
>> won't be 0-downtime. But you can use your test system to find a sequence
>> that works well enough for you.
>>
>>         f
>> --
>> Francis Daly        francis at daoine.org
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list