I set up a new webserver on Debian Bullseye (11). I have exactly the same server with Debian Stretch (9) (everything works there).
The webserver (lighttpd) writes its logs to /home/foobar/logs/
/home/foobar/logs is mounted as tmpfs
/etc/fstab:
tmpfs /home/foobar/logs tmpfs defaults,size=5G 0 0
The webserver can write its logs without any problems. but as root I can't redirect any output to the log file
cat /dev/null > /home/foobar/logs/access.log
-bash: /home/foobar/logs/access.log: Permission denied
Permissions:
-rw-r--r-- 1 www-data www-data
What I can do and what works:
cp /dev/null /home/foobar/logs/access.log
If I change the configuration of the webserver and don't write the logs to tmpfs, then everything works. So the problem has something to do with tmpfs.