httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Montague <m...@catseye.org>
Subject Re: [users@httpd] proxy_fcgi and PHP-FPM: error pages and config syntax
Date Wed, 22 Feb 2012 14:40:55 GMT
On February 22, 2012 6:10 , Jan Engelhardt <jengelh@medozas.de> wrote:
> The first issue that arises is that error page generation is completely
> left to PHP-FPM. Since FPM delivers error codes like 404 without any
> page context, one essentially gets a blank page in browsers. It is only
> wget/curl where one sees that something has yielded a 404.
>
> Can I somehow get Apache to deliver the usual text error pages when a
> FastCGI request yields a 4xx/5xx error?

Use the ProxyErrorOverride directive:

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyerroroverride


> Second, one needs to give the full filesystem path of the PHP script in
> the FastCGI request for FPM to find it. This implies splicing
> DOCUMENT_ROOT into the proxy request. "ProxyPassMatch" does not seem to
> be able to do that, so I ended up with mod_rewrite up to now. (And
> contrary to the Apache docs suggest, the [P] RewriteFlag is not to be
> used when wanting to rewrite the protocol/host portion.)
>
> RewriteEngine On
> RewriteRule \.php$ proxy:fcgi://localhost:8002/%{DOCUMENT_ROOT}/%{SCRIPT_FILENAME}
>
> I share the dismay you might be expressing at seeing that. Is there a
> nicer way to configure accessing FPM through FastCGI?

No, what I've been using is very similar:

RewriteRule ^/?(.*\.php)$ fcgi://127.0.0.1:9003/www/wp3/wordpress/$1 [P,L]

--
   Mark Montague
   mark@catseye.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message