nginx phpfpm tomcat lograotate 配置常用配置

nginx配置

#cat  /etc/logrotate.d/log-nginx
/data/wwwlogs/*.log {
  daily
  rotate 5
  missingok
  dateext
  compress
  notifempty
  sharedscripts
  postrotate
    [ -e /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
  endscript
}

php-fpm配置

cat /etc/logrotate.d/log-php 
/data/logs/php/*.log {
  daily
  rotate 5
  missingok
  dateext
  compress
  notifempty
  sharedscripts
  postrotate
    [ -e /usr/local/php/var/run/php-fpm.pid ] && kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
  endscript
}

tomcat配置

cat /etc/logrotate.d/tomcat

/usr/local/tomcat/logs/catalina.out {
daily
rotate 5
missingok
dateext
compress
notifempty
copytruncate
}

测试nginx配置

logrotate -f /etc/logrotate.d/nginx

猜你喜欢

转载自www.cnblogs.com/Qing-840/p/10893887.html