How to Fix the Apache Internal Server Error: Invalid Command ‘Header’

Apache internal server error troubleshooting showing the invalid Header command and mod_headers module configuration.

Post Date: 19 December 2020
Last Updated: 23 November 2026

Introduction

Apache internal server error messages can prevent visitors from accessing your website. One possible cause is an Apache configuration issue, which may appear in the error log with the following message:

Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

This error occurs when the Apache mod_headers module is not enabled on an Ubuntu server.

In this tutorial, we will learn how to check whether the mod_headers module is enabled, activate it if necessary, and restart Apache to apply the changes.

Prerequisites

Before troubleshooting the Apache internal server error, make sure you have:

  • An Ubuntu server running Apache.
  • SSH access to the server.
  • Sufficient permissions to enable Apache modules and restart the web server.
  • Basic knowledge of Linux commands and Apache configuration.
  • Access to the Apache error log to identify the reported error.

Steps to Fix the Apache Internal Server Error

Step 1: Check Whether the Apache Headers Module Is Enabled

First, check whether the mod_headers module is enabled in Apache by running the following command:

apache2ctl -M | grep headers
Apache internal server error troubleshooting: Checking whether the Apache mod_headers module is enabled using the apache2ctl command.

If the module is enabled, you should see the following output:

headers_module (shared)

If you do not get this output, enable the module using the following command:

a2enmod headers

Step 2: Restart the Apache Web Server

After enabling the module, restart the Apache web server for the changes to take effect:

service apache2 restart

Now, you can access your website through the browser.

If you continue experiencing the issue, you can contact our technical team for assistance with Apache configuration and server troubleshooting.

Frequently Asked Questions (FAQ)

1. What causes the Apache internal server error with the invalid ‘Header’ command?

This error occurs when the Apache mod_headers module is not enabled or loaded in the server configuration.

2. How can I check whether the mod_headers module is enabled?

Run the following command:

apache2ctl -M | grep headers

If the module is enabled, the output will include headers_module (shared).

3. How do I enable the mod_headers module in Ubuntu?

Run the following command:

a2enmod headers

4. Do I need to restart Apache after enabling mod_headers?

Yes. Restart Apache to apply the changes:

service apache2 restart

5. Will enabling mod_headers resolve the invalid ‘Header’ command error?

If the error is caused by the mod_headers module being disabled, enabling the module and restarting Apache should resolve it.

Conclusion

The Apache internal server error with the message Invalid command 'Header' can occur when the mod_headers module is not enabled.

You can resolve this issue by checking the module status, enabling it using a2enmod headers if necessary, and restarting the Apache web server.

Related Article

Official Documentation

Get Expert Support for Apache and Server Configuration

Resolving Apache errors often requires checking server modules and configuration settings to identify the cause of the problem. Pheonix Solutions provides technical services to help businesses maintain reliable websites and server environments through:

Need Assistance?

Still experiencing Apache internal server errors or having trouble with server configuration?

The technical team at Pheonix Solutions can help diagnose Apache configuration issues, troubleshoot server errors, manage hosting environments, and support your website infrastructure.

Contact our team to discuss your website and server support requirements.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Comment

Scroll to Top