Change Nginx Version Header

Edit nginx.h

$ vi src/core/nginx.h

find lines:

#define NGINX_VERSION    "0.7.64"
#define NGINX_VER        "nginx/" NGINX_VERSION

Change them as follows:

#define NGINX_VERSION    "0.7.64"
#define NGINX_VER        "kutukupret/" NGINX_VERSION

Save and close the file. Now, you can compile the server. Add the following in nginx.conf to turn off nginx version number displayed on all auto generated error pages:

server_tokens off

Above hack doesn’t work here’s the good one:
edit src/http/ngx_http_header_filter_module.c

around line 48, changing the following line to something like:

static char ngx_http_server_string[] = "Server: yourserver" CRLF;
static char ngx_http_server_full_string[] = "Server: yourserver" CRLF;

3 Comments

  1. Usualy i installed Nginx via yum but to follow this tutorial, i installed it manualy. The problem now is nginx wouldn’t start automaticaly after rebooting. Please help..

    • leenoux leenoux

      if you’re on redhat based like init script, just run this command from shell:

      # chkconfig nginx on
      

      make sure nginx is autostart:

      # chkconfig --list nginx
      nginx           0:off   1:off   2:on    3:on    4:on    5:on    6:off
      

      start nginx manually

      # service nginx start
      

      stop nginx manually

      # service nginx stop
      

Leave a Reply

Your email address will not be published. Required fields are marked *