Log rotation on Passenger + Nginx
There are three different kinds of log files:
- The webserver (Apache/Nginx) log files.
- The Passenger log files.
- The application log files.
Passenger & webserver log rotation
Passenger logs to the global webserver error log. Whenever you rotate this log file you need to instruct Passenger to reopen it by running:
The webserver should also be made aware of the rotation, if it isn't already.
Application log rotation
Applications can have their own logfiles (e.g. Rails production.log), which are not related to - or controlled by - Passenger. If the logfile is rotated without the application being aware of the process, you'll need to restart it:
passenger-config restart-app <path to app>
Some applications just log to STDOUT, which is captured by Passenger and logged into the Passenger logfile (i.e. the global webserver error log). So if this is the case the application doesn't need a restart and you can just follow the log rotation procedure for Passenger.