Hello, thanks for the report!
I attempted to reproduce the issue with the following commands, but it seems 
that error logs were sent to /var/log/nginx/error.log after a rotate as 
expected:

$ lxc launch ubuntu:noble test-nginx-noble
$ lxc exec test-nginx-noble bash

$ apt update
$ apt upgrade
$ apt install nginx curl

$ cat <<EOF >/etc/nginx/sites-available/default
server {
    listen 80;
    server_name test.local;

    location / {
        # Try to serve a file that doesn't exist
        root /nonexistent/path;
    }
}
EOF

$ systemctl restart nginx

$ curl http://localhost:80
$ cat /var/log/nginx/error.log
2025/04/28 20:09:27 [error] 2401#2401: *10 "/nonexistent/path/index.html" is 
not found (2: No such file or directory), client: 127.0.0.1, server: 
test.local, request: "GET / HTTP/1.1", host: "localhost"

$ logrotate -f /etc/logrotate.conf
$ cat /var/log/nginx/error.log
$ cat /var/log/nginx/error.log.1
2025/04/28 20:09:27 [error] 2401#2401: *10 "/nonexistent/path/index.html" is 
not found (2: No such file or directory), client: 127.0.0.1, server: 
test.local, request: "GET / HTTP/1.1", host: "localhost"

$ curl http://localhost:80
$ cat /var/log/nginx/error.log
2025/04/28 20:12:07 [error] 2402#2402: *11 "/nonexistent/path/index.html" is 
not found (2: No such file or directory), client: 127.0.0.1, server: 
test.local, request: "GET / HTTP/1.1", host: "localhost"


Is there a specific error that continues to show up in error.log.1 or any 
non-default settings in your logrotate.conf?




** Changed in: nginx (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2109253

Title:
  nginx logrotate postrotate script fails to reopen log files, causing
  logging to error.log.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/2109253/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to