Nginx _ modify the Server value in the Web Server Header

Source: Internet
Author: User

Nginx _ modify the Server value in the Web Server Header
When hackers attack a website, they often need to know the server architecture, website architecture, and other information. Once they understand this information, they will know where the website is weak! In order not to let the other party know the real environment of their webserver, we can pretend to hide our real server environment. Although security protection cannot be 100%, it will at least make the other Party feel overwhelmed! @ ''1. modify nginx server information in Windows. go to the nginx installation directory and use a text editor to edit fastcgi In the conf directory. conf fastcgi_param server_softwarengversion/$ nginx_version; 2. use a text editor to edit fastcgi_params fastcgi_param SERVER_SOFTWARE nginx/$ nginx_version; 3. # service nginx restart # restart nginx to hide nginx server Information 1. go to the nginx installation directory and use a text editor to edit nginx under the conf directory. conf # Add server_tokens off in http {}; 2. # service nginx restart # restart nginx 2. in Linux, the operation is the same as in windows, The file name may be slightly different, but I still display Nginx after the change, and then compile src/core/nginx according to the changes made on the Internet. h, Let's first look at the header information before the change: [root @ REKFAN-Server/] # curl-I http://blog.rekfan.comHTTP/1.1 200 OKServer: nginxDate: Fri, 02 Nov 2012 15:25:42 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Thu, 01 Nov 2012 18:47:51 GMTConnection: keep-aliveETag: "5092c3d7-264" Accept-Ranges: src/core/nginx after bytes modification. h. The Code is as follows:/** Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. * http://blog.rekfan.com /? P = 122 */# ifndef _ blank _ # define nginx_version 1003008 # define NGINX_VERSION "1.3.8" # define NGINX_VER "REKFAN/" NGINX_VERSION # define NGINX_VAR "REKFAN "# define NGX_OLDPID_EXT ". oldbin "# endif/* _ nginx_h_encoded ded _ */compile Nginx and check whether the result header information remains unchanged! Finally, find another post to change the src/http/ngx_http_header_filter_module.c file! Find the following two lines: static char ngx_http_server_string [] = "Server: nginx" CRLF; static char ngx_http_server_full_string [] = "Server:" NGINX_VER CRLF; change it: static char ngx_http_server_string [] = "Server: REKFAN" CRLF; static char ngx_http_server_full_string [] = "Server: REKFAN/1.0" CRLF; modify the red color to display, re-compile and restart Nginx! Review header information: [root @ REKFAN-Server/] # curl-I http://blog.rekfan.comHTTP/1.1 200 OKServer: REKFANDate: Fri, 02 Nov 2012 15:30:28 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Thu, 01 Nov 2012 18:47:51 GMTConnection: keep-aliveETag: "5092c3d7-264" Accept-Ranges: bytes later found that when we added the server_tokens off; parameter, when the value in src/http/ngx_http_header_filter_module.c is not added, the version number is src/core/nginx. h, so We try to modify them both in two places!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.