【发布时间】:2019-12-23 11:06:22
【问题描述】:
我需要将应用程序从 Apache PHP 模块迁移到 PHP-FPM,因为我发现 mod_proxy_fcgi 是首选方式。
应用程序运行旧的 Zend 框架 1。
来自 VHost 的一些相关部分:
RewriteEngine on
DocumentRoot /home/app/www
<Directory "/home/app/www">
Require all granted
AllowOverride All
Options +FollowSymLinks
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.0-fpm.sock|fcgi://php7/"
</FilesMatch>
<Proxy fcgi://php7>
ProxySet connectiontimeout=5 timeout=240
</Proxy>
我的端点是http://server/CLIENT/index.php
在 /home/app/www/CLIENT/.htaccess 我有 (as specified by the Zend Framework 1.0)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php/$0 [L]
当我点击一个标准的 php 页面时,一切顺利。但是每当我想使用路由器时,我都会得到 PHP-FPM 提供的 404(例如http://server/CLIENT/page)。我仍然可以通过直接浏览 http://server/CLIENT/index.php/page 来让我的路由器正常工作。
URL 重写运行,因为当我启用调试重写日志时,我可以看到它通过了所有规则。
有趣的是,我还用旧的 mod_fastcgi 测试了 PHP-FPM。通过这种方法,在完全相同的配置下一切顺利。更何况,重写日志的调试也是完全一样的。
我已经为此苦苦挣扎了好几天。有没有人有一个绝妙的主意来解决这个问题?
【问题讨论】: