【问题标题】:apache + php-fpm: Apache forwarding some png requests to php-fpm suddenlyapache + php-fpm:Apache 突然将一些 png 请求转发到 php-fpm
【发布时间】:2014-12-15 10:41:20
【问题描述】:

最近在使用 apache 的服务器上设置了 PHP-FPM,它运行得非常好,但是一些 png 文件我被拒绝访问,例如 https://socialsavanna.com/scripts/candy-1.6.0/res/img/action/statusmessage-off.png

在我得到的错误日志中

FastCGI: server "/{DirectoryToCGIBin}/php5-fcgi" stderr: Access to the script '/{DirectoryToWebsite}/scripts/candy-1.6.0/res/img/action/statusmessage-on.png' has been denied (see security.limit_extensions)

其他 png 工作正常,为什么 Apache 将其转发到 FastCGI 以解析为 PHP 文件?有什么想法可以阻止这种情况吗?

谢谢

编辑:配置

LoadModule fastcgi_module modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
    DirectoryIndex index.php index.html index.shtml index.cgi
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /{DirectoryToCGIBin}/php5-fcgi
    FastCgiExternalServer /{DirectoryToCGIBin}/php5-fcgi -socket /{socketPath}/php5-fpm.sock -pass-header    Authorization

    # For monitoring status with e.g. Munin
    <LocationMatch "/(ping|status)">
            SetHandler php5-fcgi-virt
            Action php5-fcgi-virt /php5-fcgi virtual
    </LocationMatch>

【问题讨论】:

  • 为什么要使用 Apache 和 PHP-FPM?为什么不使用 nginx 和 PHP-FPM?我相当肯定 Apache 自带 Apache
  • 我稍后会关注 Nginx,我对 Apache 更熟悉,所以一步一步来,但是将 mod_php 切换到 php-fpm 运行得更好。
  • "Apache 自带 Apache"?
  • @covener 我很确定 iWontStop 试图指出他们对 Apache 的仇恨。
  • 只是好奇这是什么意思(或应该说)

标签: apache php


【解决方案1】:

显然是您的 LocationMatch 在正则表达式中具有“状态”,它与您的文件名 statusmessage-on.png 匹配。

如果没有更多关于您预期匹配内容的详细信息,将很难建议如何使其更具体。如果您的意思是 URL 以其中任何一个开头,请尝试

<LocationMatch "^/(ping|status)">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多