【问题标题】:Nginx creates log files on behalf of rootNginx 代表 root 创建日志文件
【发布时间】:2015-08-28 14:57:43
【问题描述】:

最后,I've succeeded to start nginx.
现在,它代表 root 创建日志文件。
那么,有什么想法为什么会发生,我该如何解决?
nginx.conf 的第一行是user nginx;

【问题讨论】:

    标签: nginx


    【解决方案1】:

    所以,我已经设法解决了这个问题。
    其实解决方法和我的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}
    

    【讨论】:

      【解决方案2】:

      问题可能是目录的权限设置不同尝试将日志放在 doc root 中的某个位置,以便测试是否是权限问题。将您的发现更新给我,我可能会提供帮助

      【讨论】:

      • 不是目录权限的问题。文件是代表拥有该进程的用户创建的。这意味着我的日志文件是由 nginx 的主进程创建的,而不是工人。
      猜你喜欢
      • 2015-11-23
      • 2014-04-10
      • 2019-06-07
      • 2019-02-09
      • 1970-01-01
      • 1970-01-01
      • 2018-06-12
      • 2011-02-12
      相关资源
      最近更新 更多