ProxyPassMatch和Options + Indexes(mod_autoindex)

nfo*_*ced 2 php mod-proxy mod-autoindex apache2.4

我有一个简单的Apache2.4和PHP-FPM设置,我正在尝试启用+ Indexes选项,但我得到404"找不到文件".尝试访问没有索引文件的文件夹时,即使启用了autoindex也是如此.

这是我的vhost的一部分:

#php
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/fpm/fatal.sock|fcgi://

#super public directory with Indexes!
<Location /pub>
    Options +Indexes
    IndexOptions +FancyIndexing
</Location>
Run Code Online (Sandbox Code Playgroud)

当我尝试访问http://domain.com/pub/时,我希望看到我放在那里的文件列表,但我收到错误404 Not Found.

我想知道它来自何处,因为ProxyPassMatch不应转发请求,因为查询中没有.php,所以接下来是目录索引,它查找不存在的index.php(404),但为什么mod_autoindex不起作用?

当我删除ProxyPassMatch行时,autoindex工作正常,我看到列出的文件夹内容.有任何想法吗?

nfo*_*ced 5

我在这里找到了答案http://blog.famillecollet.com/post/2014/03/28/PHP-FPM-and-HTTPD-2.4-改进

As the ProxyPassMatch directive is evaluated as the very beginning of each request:
 -AddType (for MultiView) or DirectoryIndex directives are not usable
 -right management per directory is not available
 -each Alias directive needs another proxy rule

The SetHandler directive, evaluated later, is much more flexible / usable.
Run Code Online (Sandbox Code Playgroud)

所以我改变了我的vhost看起来像这样,摆脱了ProxyPassMatch指令.

<FilesMatch \.php$>
  SetHandler "proxy:unix:/var/run/fpm/fatal.sock|fcgi://"
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)

注意:此解决方案适用于Apache 2.4.9+

我想知道是否有任何性能差异和方向?