Docker中的Apache-DirectoryIndex .html与.php

我正在使用单独的httpdphp容器运行Docker安装程序。
php容器获取通过ProxyPassMatch重定向的php请求。
为此,我将其添加到了 httpd.conf

Loadmodule deflate_module /usr/local/apache2/modules/mod_deflate.so
Loadmodule proxy_module /usr/local/apache2/modules/mod_proxy.so
Loadmodule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so

<VirtualHost *:80>

    DocumentRoot /usr/local/apache2/htdocs/
    <Directory /usr/local/apache2/htdocs/>
        DirectoryIndex index.html index.php 
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    # Proxy .php requests to port 9000 of the php-fpm container
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://phpfpm:9000/usr/local/apache2/htdocs/$1
</VirtualHost>

除了DirectoryIndex的一些小问题之外,这种方法非常有效。
当我采用这种方式时,Apache会查找 index.html ,如果没有,它将使用 index.php -有效。

但是我想要相反的方式:
DirectoryIndex index.php index.html

现在Apache首先寻找 index.php -可以。但是,如果没有,则返回错误找不到文件,即使存在 index.html

我认为问题是,对 index.php 的请求被重定向,并且php容器返回404,因此Apache不会查找 index.html 了。

如何解决此问题,以便Apache在这种情况下采用 index.html

fancykee 回答:Docker中的Apache-DirectoryIndex .html与.php

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3103557.html

大家都在问