修改nginx版本名稱偽裝任意web server,nginxweb

來源:互聯網
上載者:User

修改nginx版本名稱偽裝任意web server,nginxweb

如何修改nginx預設的名稱,可以稍微的偽裝一下,也可以裝x

一般來說修改3個位置,一個是nginx.h、另一個是ngx_http_header_filter_module.c、還有一個ngx_http_special_response.c。

提示:一般修改都是在nginx編譯之前修改,修改完了之後需要重新編譯

scr/core/nginx.conf

#define NGINX_VERSION      "1.4.7"#define NGINX_VER          "nginx/" NGINX_VERSION

修改為:(其實版本號碼也可以隨意修改)

#define NGINX_VERSION      "1.4.7"#define NGINX_VER          "jdws/" NGINX_VERSION

其實修改上面一個大部分就會生效!!!

 

/src/http/ngx_http_header_filter_module.c (HTTP ResponseHeader)

static char ngx_http_server_string[] = "Server: nginx" CRLF;

修改為:

static char ngx_http_server_string[] = "Server: jdws" CRLF;

 

/src/http/ngx_http_special_response.c 

static u_char ngx_http_error_tail[] ="<hr><center>nginx</center>" CRLF"</body>" CRLF"</html>" CRLF

修改為:

static u_char ngx_http_error_tail[] ="<hr><center>jdws</center>" CRLF"</body>" CRLF"</html>" CRLF

 

除了隨意修改版本號碼之外,還可以隱藏版本號碼:

修改nginx.conf

在http{}加入

http{     server_tokens  off;  }

就可以隱藏版本號碼了。

 

注意:

關掉了server_tokens之後,nginx.conf配置的東西會無效,回去尋找剛才我們第二步和第三步的配置

未隱藏版本號碼:

隱藏版本號碼:

基本ok啦啦啦啦

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.