> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
> Use this file to discover all available pages before exploring further.

# AMZ 2023 NginxHeader

# Nginx Header Module Installation Guide

This guide explains how to install and configure the **Headers More Nginx Module**, which allows you to modify or remove response headers (e.g., hiding the `Server` header).

***

## 1. Install Build Tools

```bash theme={null}
sudo yum groupinstall "Development Tools" -y
sudo yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel wget gcc make git -y
```

***

## 2. Get Current Nginx Version

```bash theme={null}
nginx -v
NGINX_VERSION=$(nginx -v 2>&1 | awk -F/ '{print $2}')
echo "Detected Nginx version: $NGINX_VERSION"
```

***

## 3. Download and Extract Nginx Source

```bash theme={null}
cd /usr/local/src
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
tar -xvzf nginx-$NGINX_VERSION.tar.gz
cd nginx-$NGINX_VERSION
```

***

## 4. Download Headers More Module

```bash theme={null}
git clone https://github.com/openresty/headers-more-nginx-module.git
```

***

## 5. Build the Module

```bash theme={null}
./configure --with-compat --add-dynamic-module=./headers-more-nginx-module
make modules
ls -la objs/ngx_http_headers_more_filter_module.so
```

***

## 6. Install the Module

```bash theme={null}
sudo mv objs/ngx_http_headers_more_filter_module.so /usr/share/nginx/modules/
```

***

## 7. Configure Nginx

Edit **nginx.conf**:

```nginx theme={null}
load_module modules/ngx_http_headers_more_filter_module.so;

http {
    server_tokens off;              # Hides version info
    more_clear_headers Server;      # Removes the Server header entirely
}
```

***

## 8. Test and Restart

```bash theme={null}
nginx -t
sudo systemctl restart nginx
```

***

## 9. Verification

* Run `curl -I http://yourdomain.com`
* The `Server` header should be **hidden** or modified as per your config.
