Nginx 代表 root 创建日志文件

Nginx creates log files on behalf of root

芬利,
现在,它代表 root 创建日志文件。
那么,有什么想法会发生这种情况吗?我该如何解决?
nginx.conf第一行是user nginx;

问题可能是目录的权限设置不同尝试将日志放在文档根目录中的某个位置,以便您可以测试是否是权限问题。告诉我你的发现,我也许可以提供帮助

所以,我已经设法解决了这个问题。
实际上,解决方案与我中的解决方案相同:

# put SELinux in permissive mode
setenforce 0
# send USR1 signal to nginx master process
# master process reopens files, does chown() and chmod() to enable
# the worker processes to write to files, and send a notification to
# the worker procesess, so they reopen files instantly
# you can find the path to the nginx pid file in the nginx.conf
kill -USR1 `cat /var/run/nginx.pid`
# create SELinux module
grep nginx /var/log/audit/audit.log | audit2allow -M nginx
# apply module
semodule -i nginx.pp
# put SELinux back in enforcing mode
setenforce 1
# remove SELinux module files
rm -rf nginx.{pp,te}