What does 'nginx -s reopen' really do? The nginx documentation says that it reopens logs. I tried it out from a terminal while nginx was running, but nothing happened.
What does nginx -s reopen do
nginx
nginx
What does 'nginx -s reopen' really do? The nginx documentation says that it reopens logs. I tried it out from a terminal while nginx was running, but nothing happened.
Best Answer
Something happened. You just didn't see it :) Calling
nginx -s reopen
, or sending aSIGUSR1
signal to annginx
process, while causenginx
to reopen its logs files.This can become handy in case you (or a program like
logrotate
) alter a log file and wantnginx
to refresh its file descriptors. By doing this,nginx
places its write cursor at the (new) end of the file, and prevents log corruptions (which would occur ifnginx
wrote an entry at a wrong/outdated file offset).