A ChurchCRM module page shows "Page Not Found" on nginx
Why ChurchCRM's People, Ministries, Portal and similar pretty-URL pages 404 on a nginx-backed domain, and the nginx rule that fixes every one of them.
A ChurchCRM site loads normally, and old-style flat files (PersonEditor.php, FamilyEditor.php) work - but a module's own "pretty" pages (/people/dashboard, /people/list, /people/photos, /people/family, /people/map, /people/self-register, /people/view/<id>, and the equivalents under other modules) redirect to ChurchCRM's own styled "Page Not Found" screen, reached via /errors/not-found.php?path=.... This happens for every visitor, logged in or not, on every browser - it is not a permissions issue and not specific to one account.
What it means
ChurchCRM ships several self-contained modules - each one is a folder with its own index.php front controller and its own .htaccess rewrite rule (for example people/.htaccess). Apache reads whichever .htaccess happens to sit in the folder a request lands in, so under Apache (cPanel and similar) each module's own rule quietly routes its pretty URLs to that module's index.php.
nginx never reads a .htaccess file, anywhere, for any folder - this is true for every domain on this panel, not specific to ChurchCRM. Without an explicit nginx rule standing in for each module's own .htaccess, a request like /people/dashboard falls through to the site's root index.php instead, which only ever requires a file ending in .php directly - a path with no extension is rejected immediately and redirected to the not-found page. This is a real gap in the server configuration for that one domain, not a bug in ChurchCRM itself, and not something broken for this one customer specifically - any ChurchCRM install on a nginx-backed domain needs this rule.
The fix
- Open the domain's settings and find Extra nginx configuration for a single site (the per-domain custom directives editor).
- Add this rule (merge the module names into an existing rule rather than duplicate it, if one is already there):
location ~ ^/(session|admin|event|finance|fundraiser|groups|kiosk|plugins|v2|api|people|external|setup|ministries|portal)/views/.*\.php(/|$) { deny all; } location ~ ^/(session|admin|event|finance|fundraiser|groups|kiosk|plugins|v2|api|people|external|setup|ministries|portal)(?!.*\.php)(/|$) { try_files $uri $uri/ /$1/index.php?$query_string; } - Save. The panel tests the rule against nginx before it is applied, so a mistake here refuses to save rather than taking the site down.
- Reload the affected pages. A module page that used to redirect to
errors/not-found.phpshould now reach the login page (if signed out) or the real page (if signed in) - the same way a working page like/v2/dashboardalready does.
.htaccess also blocks direct requests to its views/*.php template files, specifically because those files assume the module's own front controller already ran its authentication check before including them. Without the matching nginx rule, that protection is silently missing on every module - closing it for all fifteen known modules at once, not only the ones that were actually reported broken, is worth doing in the same change.find /home/<account>/domains/<domain>/public_html -maxdepth 1 -type d -exec test -f "{}/index.php" \; -exec test -f "{}/.htaccess" \; -print - add any name this finds that is not already in the rule above.