Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

"File not found." instead of custom 404 file with php-fpm enabled

Discussion in 'EasyApache' started by PeteS, Jul 25, 2018.

Tags:
  1. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    106
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    I found that badfile.php produces "File not found." instead using the 404 error file designated in .htaccess when php-fpm is enabled. I found the solution here:

    SOLVED - Getting file not found vs 404 with PHPFPM

    WHM Home » Service Configuration » Apache Configuration » Include Editor
    Under the "Pre Main Include" section, add: ProxyErrorOverride on

    But that breaks webmail.domain.tld giving this error:

    "Access Denied
    This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

    Additionally, a 401 Unauthorized error was encountered while trying to use an ErrorDocument to handle the request."

    Anyone get this sorted...?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @PeteS,

    I did find one report where a customer successfully used an .htaccess rule like the one below for the individual accounts as an alternative:

    Code:
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule ^.+\.php$ /404.shtml
    
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    106
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    Thanks. It just seems like there should be as more universal solution, or that the above solution shouldn't break webmail. I'll post back if I find anything.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello Pete,

    One possible solution here is to enable ProxyErrorOverride under the "Pre Main Include" section in "WHM Home » Service Configuration » Apache Configuration » Include Editor", but with exceptions that exclude proxy subdomains. Here's a third-party URL that may help:

    How to add exceptions to apache reverse proxy rules

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. PeteS

    PeteS Well-Known Member

    Joined:
    Jun 8, 2017
    Messages:
    106
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    Oregon
    cPanel Access Level:
    Root Administrator
    In glancing at that page I don't see the connection. I'll have to give this further consideration after I get back in the office week after next... :)
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice