Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx Logrotate problems.

Discussion in 'Beta release code' started by wmtech, May 26, 2026.

  1. wmtech

    wmtech Active Member

    187
    44
    28
    Jul 22, 2017
    Ratings:
    +139
    Local Time:
    11:49 PM
    We are running the most recent version of Centmin Mod 140.00beta01 at a Rocky 9.7 server.

    Recently there seems to have been an update to the file /etc/logrotate.d/nginx. The file was modified May 22 20:07.


    Since then we are getting logrotate errors:

    Code:
    May 26 00:00:01 ******** systemd[1]: Starting Rotate log files...
    May 26 00:00:01 ******** logrotate[3649185]: error: error setting owner of /home/nginx/domains/********/log/wp_updater-240526-020520.log to uid 0 and gid 1068: Operation not permitted
    May 26 00:00:02 ******** logrotate[3649185]: error: error setting owner of /home/nginx/domains/********/log/wp_updater-240526-020415.log to uid 0 and gid 1068: Operation not permitted
    May 26 00:00:02 ******** logrotate[3649185]: error: error setting owner of /home/nginx/domains/gdt.at/********/wp_updater-240526-020542.log to uid 0 and gid 1068: Operation not permitted
    May 26 00:00:02 ******** logrotate[3649185]: error: error setting owner of /home/nginx/domains/********/log/wp_updater-240526-020148.log to uid 0 and gid 1068: Operation not permitted
    May 26 00:00:02 ******** logrotate[3649185]: error: error setting owner of /home/nginx/domains/********/log/wp_updater-240526-021616.log to uid 0 and gid 1068: Operation not permitted
    May 26 00:00:02 ******** systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
    May 26 00:00:02 ******** systemd[1]: logrotate.service: Failed with result 'exit-code'.
    May 26 00:00:02 ******** systemd[1]: Failed to start Rotate log files.
    gid 1068 is nginx group.

    All wp_updater-* files in logs are owned by root/nginx.

    So what is the problem here that lets us restart logrotate almost daily at that server?
     
  2. wmtech

    wmtech Active Member

    187
    44
    28
    Jul 22, 2017
    Ratings:
    +139
    Local Time:
    11:49 PM
    If someone has the same problem, this is the fix:

    Code:
    vi /etc/logrotate.d/nginx
    Change the second block to add create 0644 nginx nginx:

    Code:
    /home/nginx/domains/*/log/*.log /home/nginx/domains/*/log/*.json {
           su nginx nginx
           daily
           dateext
           missingok
           rotate 10
           compress
           delaycompress
           notifempty
           create 0644 nginx nginx
           postrotate
           /bin/kill -SIGUSR1 $(cat /usr/local/nginx/logs/nginx.pid 2>/dev/null) 2>/dev/null || true
           endscript
    }
     
  3. eva2000

    eva2000 Administrator Staff Member

    58,892
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    7:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Thanks for heads up, should be fixed in 132.00stable, 140.00beta01 and 141.00beta01, so run cmupdate and run and exit centmin.sh menu once