proxy_fcgi and PHP-FPM: error pages and config syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux