Nginx Custom Headers - Kick Ass Server :P

Status
Not open for further replies.

desiboy

Active Member
1,544
2008
7
0
Intro :
In this tutorial , I will be showing how to Edit the default Server Headers of Nginx and set them to the required ones ..

If you are aware of the word server header , read this :
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

for example if you find Google's server header , it says :
Server: gws

....................................................

you can find headers using curl

curl -I google.com

or use an online tool
http://www.seoconsultants.com/tools/headers

....................................................

download nginx source

from
http://nginx.org/

then untar it ..
browse to src/http/

Open ngx_http_header_filter_module.c for editing

find

PHP:
static char ngx_http_server_string[] = "Server: nginx" CRLF;
static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
and change it to the desired value

63b7067a.png





now compile nginx as usual with your custom settings and requirements ..

for this tutorial , I am just compiling with default options,

./configure
make
make install

start nginx ( you can directly start by going into the directory in which it was installed and call it or create an init script for making things easier )

here's my result for server header :

7b5c0bee.png



Tutorial by desiboy @ wjunction !
leave a link to this thread , if you post in somewhere else . :)
 
3 comments
Status
Not open for further replies.
Back
Top