NginxProxyManager / NginxProxyManager/nginx-proxy-manager
Log rotate is broken (including easy fix)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34.2k
- Forks
- 3.9k
- Avg merge
- 21h 12m
- Merged PRs (30d)
- 20
Description
Checklist
- Have you pulled and found the error with
jc21/nginx-proxy-manager:latestdocker image?- Yes
- Are you sure you're not using someone else's docker image?
- Yes
- Have you searched for similar issues (both open and closed)?
- Yes
Describe the bug
After months of running smoothly with default settings, the container suddenly stopped working properly. The Web UI showed "internal error" for any attempted changes.
Long story short, it turned out to be a storage issue. My storage limit of 4GB was full due to oversized log folders.
The du command returned:
...
769M /var
341M /root
1.6G /data
...
1.6G /data/logs
...
399M /var/log
...
1.1G /data/logs/proxy-host-8_access.log
Root cause:
logrotate -d /etc/logrotate.d/nginx-proxy-manager returns:
reading config file /etc/logrotate.d/nginx-proxy-manager
error: /etc/logrotate.d/nginx-proxy-manager:2 unknown user 'npm'
error: found error in /data/logs/*_access.log /data/logs/*/access.log , skipping
removing last 1 log configs
error: /etc/logrotate.d/nginx-proxy-manager:16 unknown user 'npm'
error: found error in /data/logs/*_error.log /data/logs/*/error.log , skipping
removing last 1 log configs
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
checking the logrotate configuration /etc/logrotate.d/nginx-proxy-manager:
cat /etc/logrotate.d/nginx-proxy-manager
/data/logs/*_access.log /data/logs/*/access.log {
su npm npm
create 0644
weekly
rotate 4
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript
}
/data/logs/*_error.log /data/logs/*/error.log {
su npm npm
create 0644
weekly
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript
Please note that the user npm does not exist. Instead nginx runs as root. Also, the PID-Path is wrong
FIX:
I suggest changing /etc/logrotate.d/nginx-proxy-manager to this:
/data/logs/*_access.log /data/logs/*/access.log {
create 0644 root root
weekly
rotate 4
missingok
notifempty
compress
maxsize 100M
maxage 365
dateext
sharedscripts
postrotate
/bin/kill -USR1 `cat /usr/local/openresty/nginx/logs/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript
}
/data/logs/*_error.log /data/logs/*/error.log {
create 0644 root root
weekly
rotate 10
missingok
notifempty
compress
maxsize 50M
maxage 365
dateext
sharedscripts
postrotate
/bin/kill -USR1 `cat /usr/local/openresty/nginx/logs/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript
}
Then run logrotate -v -f /etc/logrotate.d/nginx-proxy-manager
Optional for testing, run first logrotate -d /etc/logrotate.d/nginx-proxy-manager, to see what will happen.
The final result:
23M /data/logs
Nginx Proxy Manager Version
v2.11.1
To Reproduce
Steps to reproduce the behavior:
logrotate -d /etc/logrotate.d/nginx-proxy-manager- See error
Expected behavior
Logs in /data/logs should get rotated and compressed
Operating System
Proxmox, running as LXC
using release: https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest
Additional context
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating how the container generates /etc/logrotate.d/nginx-proxy-manager, then run logrotate -d against that configuration to reproduce the reported errors. Verify the resulting configuration rotates and compresses logs under /data/logs without filling the storage volume, and confirm it with logrotate -v -f.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, nginx
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100