httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Engelhardt <jeng...@medozas.de>
Subject [users@httpd] proxy_fcgi and PHP-FPM: error pages and config syntax
Date Wed, 22 Feb 2012 11:10:15 GMT
Apache 2.3/2.4 has a new "mod_proxy_fcgi" module. For fun (and maybe, 
profit), I was experimenting in using proxy_fcgi in conjunction with 
PHP-FPM instead of mod_php5 for execution of PHP scripts.


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?


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?


thanks,
Jan

---------------------------------------------------------------------
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