るいすのブログ

オタクエンジニアの雑記

Nginx で logrotate したのに新しいファイルに書き込まれない


nginx -s reopen

でエラーがでないなら

"/var/log/nginx/access.log" "/var/log/nginx/error.log" {
  missingok
  notifempty
  daily
  rotate 7
  su nginx nginx
  create 666 nginx nginx
  notifempty
  sharedscripts
  postrotate
      nginx -s reopen
  endscript
}

こうしましょう。

よくある postrotate

[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`

これでダメなら、↑ のように変更してみると良いですよ。