Nginx 代表 root 创建日志文件 [英] Nginx creates log files on behalf of root

查看:58
本文介绍了Nginx 代表 root 创建日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后,我已成功启动 nginx.
现在,它代表 root 创建日志文件.
那么,有什么想法为什么会发生,我该如何解决?
nginx.conf的第一行是user nginx;

推荐答案

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

So, I've managed to fix that.
Actually, the solution is the same as in my prequel question:

# 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}

这篇关于Nginx 代表 root 创建日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆