httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Montague <>
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 <> 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:

> 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://$1 [P,L]

   Mark Montague

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message