# 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

**Code:** `AH00526: Syntax error on line of apache config` · **Category:** Nginx / Apache · **Seen on:** Apache, Linux

Apache's config has a syntax problem or a directive from a module that isn't loaded.

## 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

1. `sudo apachectl configtest`
2. Enable the module: `sudo a2enmod rewrite && sudo systemctl restart apache2`
3. Fix the typo or closing tag

## Detailed fix by platform

### Linux

1. `sudo apachectl configtest && sudo systemctl reload apache2`

## How to diagnose

1. **Line** — File and number?
2. **Module** — Loaded?
3. **Tags** — Balanced?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nginx-apache/ah00526-syntax-error-in-apache-config)
