Apache: AH00526: Syntax error on line 12 of /etc/apache2/sites-enabled/site.conf: Invalid command 'Foo', perhaps misspelled or defined by a module not included in the server configuration
Apache's config has a syntax problem or a directive from a module that isn't loaded.
AH00526: Syntax error on line 12 of /etc/apache2/sites-enabled/site.confInvalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configurationSyntax error on line of apache2.confInvalid command 'Header', perhaps misspelledAction 'configtest' failed. The Apache error log may have more information Meaning
Run apachectl configtest for the exact file/line. "Invalid command" usually means the module isn't enabled (a2enmod rewrite headers ssl proxy_http) or a typo. Missing </VirtualHost> or mismatched tags cause similar errors.
Common causes
- Module not enabled (rewrite, headers, ssl, proxy)
- Typo in directive
- Unclosed container tag
- Wrong syntax for the Apache version (2.2 vs 2.4)
- Included file broken
⚡ Quick fix
sudo apachectl configtest- Enable the module:
sudo a2enmod rewrite && sudo systemctl restart apache2 - Fix the typo or closing tag
Detailed fix by platform
Linux
sudo apachectl configtest && sudo systemctl reload apache2
How to diagnose
- Line — File and number?
- Module — Loaded?
- Tags — Balanced?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- .htaccess: Invalid command (500 Internal Server Error) Apache: [core:alert] /var/www/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
- AH00015: Unable to open logs Apache: AH00091: apache2: could not open error log file /var/log/apache2/error.log. AH00015: Unable to open logs (Permission denied)
- AH00037: Symbolic link not allowed or link target not accessible Apache: [core:error] AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/current
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- Welcome to nginx! shown instead of my site Browser: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026