---
title: "Replace Apache Servername in HTTP Headers"
description: "HTTP header modifications can harden your Linux server and obfuscate sensitive data to make cyber reconnaissance harder for cyber attackers. It is for this reason that many Linux system..."
url: https://www.inmotionhosting.com/support/server/apache/change-apache-servername/
date: 2021-09-13
modified: 2021-09-13
author: "InMotion Hosting Contributor"
categories: ["Apache"]
type: post
lang: en
---

# Replace Apache Servername in HTTP Headers

![Change the Apache Servername](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/canva-apache-servername-1024x538.jpg)

HTTP header modifications can harden your Linux server and obfuscate sensitive data to make cyber reconnaissance harder for cyber attackers. It is for this reason that many Linux system administrators decide to change Apache servername HTTP header information. HTTP responses from your Apache server will include the following by default:

`HTTP/1.1 200 OK`
`Date: Mon, 10 Sep 2021 16:01:11 GMT`
`Server: Apache/2.4.10 (Debian)`

There are multiple ways to view a server’s HTTP headers. The easiest methods: SecurityHeaders.com, Observatory.Mozilla.org, or the command-line interface (CLI).

curl --head yourdomain.com

!["curl --head" command results](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/curl-head.png)

wget --server-response --spider yourdomain.com

!["wget --server-response --spider" command results](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/wget-http-headers.png)

Read on to learn how to set a custom Apache servername.

Ensure you have root access to your Linux server and [ModSecurity](https://www.inmotionhosting.com/support/server/apache/install-modsecurity-apache-module/) (mod_security) Apache module installed.

## Change Apache Servername in HTTP Headers

cPanel VPS or dedicated server administrators should follow these steps:

1. Log into WebHost Manager (WHM) as root.
2. On the left, select “Apache Configuration.”
3. Select “Global Configuration.”
4. Set “Server Signature” to “Off.”
5. Set “Server Tokens” to “Minimal.” ![WHM server signature and server tokens](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/whm-server-signature-tokens-1024x177.png)
6. Select “Save” at the bottom.
7. Select “Rebuild Configuration and Restart Apache.”
8. Select “Terminal” on the left.
9. Edit your ModSecurity user configuration file:nano /etc/apache2/conf.d/modsec/modsec2.user.conf
10. It’s okay if the file is blank. Add the following lines, changing the custom server signature to your preference: ServerTokens OSSecServerSignature "CustomSecretiveName"
11. Rebuild HTTPD: /scripts/rebuildhttpdconf
12. Restart Apache: /scripts/restartsrv_httpd
13. Check your Apache servername. curl --head localhost![Updated Server results](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/curl-head-updated.png)

The steps below are for non-cPanel servers.

1. Log into SSH as root.
2. Edit your Apache configuration file.CentOS:nano /etc/httpd/conf/httpd.confDebian / Ubuntu:nano /etc/apache2/conf-enabled/security.conf
3. Add or change the following lines as follows. For example, if `ServerTokens OS` is present, change “OS” to “Full.”SecRuleEngine onServerTokens FullSecServerSignature "CustomSecretiveName"
4. You can remove, or disable (#), the “ServerSignature” line if enabled.
5. Save your changes.
6. Restart Apache.CentOS:systemctl restart httpdDebian / Ubuntu:systemctl restart apache2
7. Check your Apache servername.![Updated Server results](https://www.inmotionhosting.com/support/wp-content/uploads/2021/09/curl-head-updated.png)

Are you in the middle of a cybersecurity audit? Just looking for ways to better protect your digital assets? Learn more about server hardening with our [Linux VPS security eBook](https://www.inmotionhosting.com/blog/secure-your-linux-vps/).

If you don’t need cPanel, don’t pay for it. Only pay for what you need with our scalable [Cloud VPS Hosting](https://www.inmotionhosting.com/cloud-vps).

![check mark](https://design.inmotionhosting.com/assets/icons/standard/check-blue.svg)CentOS, Debian, or Ubuntu ![check mark](https://design.inmotionhosting.com/assets/icons/standard/check-blue.svg)No Bloatware ![check mark](https://design.inmotionhosting.com/assets/icons/standard/check-blue.svg)SSH and Root Access
