nginx——网站显示问题

一般来说修改3个位置,一个是nginx.h、另一个是ngx_http_header_filter_module.c、还有一个ngx_http_special_response.c。

提示:一般修改都是在nginx编译之前修改,修改完了之后需要重新编译
cd 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

cd /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;

vim /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配置的东西会无效,回去寻找刚才我们第二步和第三步的配置