Fix Apache AH01797: client denied by old Order/Deny rules
AH01797 is a 403 from 2.2-style Order/Deny, not from Require. Find the leftover rules, convert them to Require, and see why mixing them overrides Require.
[Tue Oct 27 01:08:02.125925 2026] [access_compat:error] [pid …] [client 127.0.0.1:51158] AH01797: client denied by server configuration: /srv/site/html/server-statusThe module in this 403 is [access_compat:error]. The request was blocked by **2.2-style Order, Allow and Deny** (mod_access_compat), not by a 2.4 Require, so adding Require all granted does not open it. Find where the old rules remain and convert them to Require.
AH01630 has the same text but is logged as [authz_core:error] and comes from Require. That case, and sorting 403s by AH number, is in Fix Apache 403 AH01630 with Require all granted; this page covers only AH01797.
[1] Find the old directives. Search the config directory and .htaccess files under the document root. Ubuntu uses /etc/apache2; the official image and source builds use /usr/local/apache2/conf.
# grep -RniE '^\s*(Order|Allow from|Deny from|Satisfy)\b' /etc/apache2 /srv/site/html/srv/site/html/admin/.htaccess:1:Order deny,allow/srv/site/html/admin/.htaccess:2:Deny from all/srv/site/html/admin/.htaccess:3:Allow from 203.0.113.0/24A .htaccess shipped with an old application is a common culprit. In the test, with Require all granted on the parent <Directory>, only /admin/ (where this .htaccess lives) returned 403 with AH01797; / returned 200.
[2] If Require is there and access is still denied, old and new rules are mixed. The Apache 2.4 upgrade guide uses exactly this example: Order deny,allow and Deny from all on <Directory "/">, Require local on <Location "/server-status"> — and a local request still gets 403. The guide explains that "mod_access_compat directives take precedence over the mod_authz_host one in this configuration merge scenario". The same config on 2.4.69. In the test output below and later, request path -> number is the status code printed by the test script, and the ## … and --- error.log lines are section headers the script added.
/server-status -> 403/ -> 403[3] One more common mistake: Order allow,deny with only a Deny from line and no Allow from all blocks every client, not just the one address. With allow,deny, anything not matched by Allow is denied by default. In the test, a directory with only Deny from 198.51.100.7 denied a request from 127.0.0.1 with AH01797.
[Tue Oct 27 01:08:04.197389 2026] [access_compat:error] [pid …] [client 127.0.0.1:51180] AH01797: client denied by server configuration: /srv/site/html/[4] Convert the old rules to Require. The guide also recommends moving to the new directives instead of mixing.
| 2.2 style | 2.4 style |
|---|---|
Order deny,allow · Deny from all | Require all denied |
Order allow,deny · Allow from all | Require all granted |
Order deny,allow · Deny from all · Allow from 203.0.113.0/24 | Require ip 203.0.113.0/24 |
Order allow,deny · Allow from all · Deny from 198.51.100.7 | <RequireAll> with Require all granted · Require not ip 198.51.100.7 |
To block one address, wrap the rules in RequireAll so a request must satisfy both "everyone" and "not that address". In the test this returned 200 for /.
<Directory "/srv/site/html"> <RequireAll> Require all granted Require not ip 198.51.100.7 </RequireAll></Directory>Replace the .htaccess with one line. **Before that, check that AllowOverride on the parent <Directory> includes AuthConfig (or All).** The old Order/Deny worked in .htaccess with Limit alone, but [Require needs the AuthConfig override](https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require) to be used in .htaccess.
# grep -RniE '^\s*AllowOverride' /etc/apache2If only AllowOverride Limit is set, the whole directory turns into 500 and the error log gets the line below. This is the same .htaccess in the test with only AllowOverride changed.
## AllowOverride Limit + .htaccess 'Require ip 127.0.0.1'/ -> 200/admin/ -> 500--- error.log[Tue Oct 27 01:54:50.502929 2026] [core:alert] [pid …] [client 127.0.0.1:54190] /srv/site/html/admin/.htaccess: Require not allowed here## AllowOverride AuthConfig Limit + .htaccess 'Require ip 127.0.0.1'/ -> 200/admin/ -> 200Change AllowOverride Limit to AllowOverride AuthConfig Limit and reload as in step [5]. With AllowOverride None, .htaccess is not read at all, so the restriction is not applied either (in the test /admin/ returned 200); in that case put the rule directly inside <Directory> instead.
Require ip 203.0.113.0/24[5] Test the syntax, reload, and check one address that should be blocked and one that should pass.
# apachectl configtest && apachectl gracefulAfter the change /admin/ is still 403, but the module in the log changed. Require ip now blocks it, which is intended. A request from inside the allowed range should get 200 (in the test, Require ip 127.0.0.1 returned 200).
[Tue Oct 27 01:08:12.477535 2026] [authz_core:error] [pid …] [client 127.0.0.1:60422] AH01630: client denied by server configuration: /srv/site/html/admin/[6] When all old rules are converted, disable mod_access_compat (a2dismod access_compat on Ubuntu). Any Order left in the config files then stops the config test with Invalid command 'Order', which reveals what was missed. The config test does not read .htaccess files, so run the grep from [1] once more first and make sure the .htaccess side is empty.
Analyze your Apache log in the browser ↗ — nothing is uploaded.