Related resource(s):
“linuxcommand: logrotate”:http://linuxcommand.org/man\_pages/logrotate8.html logrotate is designed to ease administration of systems that generate large numbers of log files. Normally, logrotate is run as a daily cron job.
Some important knowledges:
example.com
/var/www/example/
/var/www/example/shared/log/
/var/www/example/shared/log/
and their names start with nginx_
You should be able to find the directive shown below, if not, append it manully.
A. Create new rotate config file for application log:
Type following contents, and save.
B. Create new rotate config file for server log:
Type following contents, and save.
Attention: /var/run/nginx.pid is your nginx pid file path, but someone may use default nginx pid path( /opt/nginx/logs/nginx.pid ). You have two solutions to solve this conflict:
A. Change
/var/run/nginx.pid
to/opt/nginx/logs/nginx.pid
or other path you have defined in your nginx config file. B. Set your “pid” directive to expected path:
pid /var/run/nginx.pid;
in your nginx config file(such as, /opt/nginx/conf/nginx.conf), and then restart your server.
If the above work are all finished, everything done! You should remember to check if everything runs normally at other days.