【问题标题】:mod-xsendfile 404 caused by SELinux由 SELinux 引起的 mod-xsendfile 404
【发布时间】:2013-11-05 23:33:40
【问题描述】:

好的。想分享这个 - 我花了 10 个小时才弄清楚。

按照here 的良好说明,我已经正确安装了 mod-xsendfile。

我还在 /etc/httpd/conf/httpd.conf 文件中正确配置了 xsendfile,并添加了设置: XSendFile 开启 XSendFilePath /var/files_need_valid_session_to_view/

而且我知道生成 X-SENDFILE 标头的代码是正确的:它在不同的服务器上运行。但是,无论我做什么,我都会收到 404 错误。我的操作系统是 CentOS 6.4 final。

【问题讨论】:

    标签: php apache http-status-code-404 selinux x-sendfile


    【解决方案1】:

    使用正确的 SELinux 标签标记您的目录。请参阅How to label an apache directory,这与您的文件夹“/var/files_need_valid_session_to_view/”的情况相同。

    禁用 SELinux 会带来不必要的安全风险。

    【讨论】:

      【解决方案2】:

      Disabling SELinux 解决了这个问题。我敢肯定,如果这是一个生产服务器,我应该配置 SELinux 以允许 Apache 查看/var/files_need_valid_session_to_view/,但就我的目的而言,这已经足够了。

      $ sudo su
        -or-
      $ su
      # echo 0 >/selinux/enforce    // Note - you cannot just say sudo for this line: the stuff after the carrot will not be super-user.  sudo su, then do this.
      
      -to perminantly disable, across reboots, see the link at the top of my answer-
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-23
        • 2021-12-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-03
        相关资源
        最近更新 更多