Apache Config Audit Guide: ServerTokens, TraceEnable and the .htaccess Split

An Apache config audit is a static review of an httpd.conf, virtual-host config or .htaccess file — its TLS settings, headers, exposure switches and access rules — checked line by line against known-good practice, without running the server. The file is small, usually a few hundred lines, but it decides what your server reveals, which TLS versions it will negotiate, which headers protect your users, and which paths are public. This guide walks through the settings that matter, the .htaccess split that quietly taxes every request, the 2.2-to-2.4 migration gotcha that still sits in production configs, and the mistakes that show up again and again — then shows you how to run the same audit yourself with the Apache Config Auditor.

What an Apache config audit actually checks

A config audit reads the file the way Apache reads it: as a flat list of directives, grouped by sections. A <VirtualHost> is one site, a <Directory> or <Location> scopes rules to a path, and a <FilesMatch> scopes them to filenames. Because most directives inherit from parent to child, a single line in the wrong place — or missing in the right place — changes every site on the box. An audit therefore checks both presence and placement: is the setting there, and is it where it actually takes effect?

The checks fall into four families. Transport security: which TLS versions and ciphers are offered, and whether the modern ones are on. Information exposure: what the server volunteers about itself, and what it lists for anyone who asks. Access control: who may reach which path, and whether the rules use the current 2.4 model or the retired 2.2 one. And operational basics: compression, timeouts, body limits and logging — the settings whose absence is only noticed during an incident. The Apache Config Auditor runs 38 such rules and scores the result from 0 to 100; its sibling tools do the same for nginx.conf and sshd_config.

The settings that decide your security posture

Four lines do most of the work. ServerTokens Prod stops Apache printing its version in error pages and the Server header, where it serves as a shopping list for exploits. TraceEnable Off closes the HTTP TRACE method — and it must be set explicitly, because the 2.4 default is On, which enables cross-site tracing. SSLProtocol should offer TLSv1.2 and TLSv1.3 only: TLSv1 and TLSv1.1 were deprecated by RFC 8996, and SSLv3 has been broken since POODLE. And SSLHonorCipherOrder on makes the server’s ordered cipher list win, instead of letting the client pick the weakest cipher both sides support.

Then come the exposure switches. Options Indexes turns a directory without an index file into a browsable listing of everything in it — backups included. <Directory /> without Require all denied leaves the filesystem root unlocked in principle, and the fix is one block at the top of every config, opening up only the directories the server must serve. Sensitive paths — /server-status, /server-info, /admin, /wp-admin — need a Require rule of their own, and .ht* files need a <FilesMatch "^\.ht"> block that denies them, or .htpasswd is fetchable over HTTP. None of these is exotic, and all of them are missing from a surprising share of production configs — usually not by decision, but because the config grew by copy-paste and nobody ever read it end to end. That reading is the audit.Apache Config Auditor showing the broken demo config at score 12 of 100, Poor, with 34 findings

The .htaccess split — and what it costs

Apache splits configuration across two levels. httpd.conf and the virtual-host files it includes set server-wide policy once, at startup. A .htaccess file in a directory overrides that policy per request — for that directory and everything below it. That flexibility is the reason .htaccess exists, and the reason it costs: with AllowOverride All, Apache must look for a .htaccess file in every directory on the path of every request, and re-read the ones it finds, before it can serve anything. On a deep path that is several file lookups per request, on every request, forever.

The two settings to get right are therefore AllowOverride and where the rules live. If nothing in a directory needs per-directory overrides — and on most single-application servers, nothing does — set AllowOverride None and move the rules into the server config, where they are read once at startup. The performance gain is real, and so is the security gain: a .htaccess file in a subdirectory can undo a hardening setting made in httpd.conf, and the audit of the server config alone will never see it. That is why the auditor flags AllowOverride All as an info, and why it cannot audit .htaccess files it was never given — audit those too, with the .htaccess mode on the tool page.

The 2.2 to 2.4 migration gotcha

Apache 2.4 replaced the whole access-control model. In 2.2, access was decided by Order, Allow and Deny: Order allow,deny plus Deny from all meant “deny everyone”, and the order of the two words mattered in ways that confused even experienced admins. In 2.4, one directive does the job: Require all denied blocks everyone, Require all granted allows everyone, Require ip 10.0.0.0/8 allows a network, Require valid-user demands authentication. The new model is simpler, and it is the only one that works: the old directives still parse, but under 2.4 they are handled by a compatibility module that does not always do what the original author meant.

That is the gotcha, and it is still live in production configs a decade after the change: a file that says Allow from all looks open, a file that says Deny from all looks closed, and neither statement is reliable under 2.4 without the compatibility module loaded and behaving. The same goes for NameVirtualHost, removed in 2.4 — name-based virtual hosting is now automatic, and the line does nothing. The auditor flags every Order, Allow and Deny it finds, and the fix is always the same: rewrite the rule with Require and delete the old lines. If you copy a snippet from a pre-2012 tutorial, this is the first thing to check.

The five mistakes the auditor flags most

Across real-world configs, the same five findings recur. First, TraceEnable left on — not by choice, but because nobody knew the default is On and it has to be turned off explicitly. Second, ServerTokens left on OS — the default nobody turned off. Third, old TLS: an SSLProtocol line copied from a decade-old tutorial, still offering TLSv1 to anyone who asks, with RC4 or 3DES in the cipher list. Fourth, Options Indexes on a document root that also holds backups. Fifth, missing security headers — HSTS, X-Content-Type-Options, framing protection, Referrer-Policy — usually because they were never added rather than removed.

The demo config below manages most of them in 40 lines, plus a few extras: an unlocked filesystem root, an unguarded /server-status, .ht* files left open, deprecated 2.2 rules, a NameVirtualHost line that does nothing, and a Listen 8080 with no virtual host behind it. The auditor scores it 12 out of 100, band Poor, with 34 findings: 5 errors, 18 warnings and 11 infos. Its hardened twin — same shape, every finding fixed — scores 100.

What a static audit cannot see — and auditing yours in five minutes

A static audit reads text, and its limits are the limits of text. It cannot see the certificate files the config points at — an expired or mismatched certificate passes every check in this guide. It cannot see included files (Include lines are noted, not followed), which modules your binary actually loaded at runtime, whether an .htaccess override in a subdirectory undoes a setting, or the firewall in front of the server. It also cannot prove the running server loaded this file at all. On the server itself, apachectl configtest validates the syntax and apachectl -S dumps the virtual-host layout — the audit is the fast, safe first pass before that, and the only pass you can run on a config someone emailed you.

To audit yours in five minutes: copy the config (or the one virtual-host file you care about), paste it into the Apache Config Auditor — it runs entirely in your browser, and the config is never uploaded, which matters because a config names certificate paths, internal paths and admin allow-lists. Fix the errors first (TraceEnable, old TLS, weak ciphers, Options Indexes, the filesystem root), then the warnings, then work through the infos as a list of defaults worth setting explicitly. Export the findings CSV if you want the checklist in a ticket. Then do the same for every file your main config includes — and for the .htaccess files in the directories it serves, with the .htaccess mode on the tool page — because a clean httpd.conf can include a very broken virtual host.

The broken demo config, verbatim

# Demo Apache config — deliberately broken. Do not deploy.
ServerTokens OS
ServerSignature On
TraceEnable On
Timeout 300

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/example

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/www/example>
        Options Indexes FollowSymLinks Includes ExecCGI MultiViews
        AllowOverride All
    </Directory>

    <Location /server-status>
        SetHandler server-status
    </Location>

    <FilesMatch "^\.ht">
        Require all granted
    </FilesMatch>

    Order allow,deny
    Allow from all
    NameVirtualHost *:80
</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    SSLProtocol TLSv1 TLSv1.1 TLSv1.2
    SSLCipherSuite RC4:3DES:HIGH
    SSLHonorCipherOrder off
    SSLSessionTickets on
    FileETag INode MTime Size
</VirtualHost>

Listen 8080

Sources

Frequently asked questions

How often should I audit my Apache config?

Every time it changes — and once even if it never does. Configs drift by copy-paste: a snippet from a tutorial adds an old SSLProtocol line, a directory added for one launch keeps its Options Indexes. An audit takes minutes and reads the file the way an attacker’s checklist would.

Is a high score a guarantee my server is secure?

No. The audit checks the text of one file against known-good practice. It cannot see certificate files, included files, modules loaded at runtime, .htaccess overrides in subdirectories or your firewall, and it cannot prove the running server loaded this config. Treat a high score as “no known-bad pattern in this file” — then run apachectl configtest and apachectl -S on the server for the rest of the picture.

Why does the auditor run in the browser?

Because a config names things you do not publish: certificate and key paths, internal paths, allow-lists for admin paths. The Apache Config Auditor parses the file locally — it is never uploaded, stored or sent anywhere — so auditing it does not create the exposure the audit is looking for.