Re: proxy_fcgi and PHP-FPM: error pages and config syntax

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

 



On February 22, 2012 6:10 , Jan Engelhardt <jengelh@xxxxxxxxxx> 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@xxxxxxxxxxx


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