Getting file not found vs 404 with PHPFPM
Just upgraded to EA4 and provisioned with PHP71 and FPM. Generally worked though a few migration issues but noticed a bunch of errors in Apache log:
Errors where frequent but sporatic. Eventually determined they were caused by a request for *.php page that didnt exist. User would simply see 'file not found' instead of normal 404 exception page. Relavant directives in httpd.conf:
Presumably the proxy is getting the bad page request before my 404 exception coding can deal with it. How can I intercept these errors and perform proper 404 exception handling?
proxy_fcgi AH01071: Got error "Primary script unknownErrors where frequent but sporatic. Eventually determined they were caused by a request for *.php page that didnt exist. User would simply see 'file not found' instead of normal 404 exception page. Relavant directives in httpd.conf:
SetHandler proxy:unix:/opt/cpanel/ea-php71/root/usr/var/run/php-fpm/e052082a6e5649ecf631cbb5460a54c838adacd4.sock|fcgi://my.domain.com/
Presumably the proxy is getting the bad page request before my 404 exception coding can deal with it. How can I intercept these errors and perform proper 404 exception handling?
-
Hello, I believe the Apache option you are looking for is "ProxyErrorOverride": mod_proxy - Apache HTTP Server Version 2.4 You can turn this option on with a line such as this under the "Pre Main Include" section in "WHM Home " Service Configuration " Apache Configuration " Include Editor": ProxyErrorOverride on
Thank you.0 -
Thanks Michael. I had read about that as a possible fix but was having challenges overriding the vhost configuration. But since it could apply to all vhosts... your suggestion was perfect. It worked fine. Many thanks. 0 -
Also, please include the 'PoxyErrorOverride On' code in the Post VirtualHost Include. It sometimes breaks WebMail as listed in the thread SOLVED - "File not found." instead of custom 404 file with php-fpm enabled.
Update: this solution is intermittently not working. Possibly a cPanel update made a change? I'm pursuing it in the other thread.0
Please sign in to leave a comment.
Comments
3 comments