What does nginx -s reopen do?

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.

Asked By: Prachi

||

Something happened. You just didn’t see it 🙂 Calling nginx -s reopen, or sending a SIGUSR1 signal to an nginx process, while cause nginx to reopen its logs files.

This can become handy in case you (or a program like logrotate) alter a log file and want nginx 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 if nginx wrote an entry at a wrong/outdated file offset).

Answered By: John WH Smith
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.