隐藏

隐藏nginx的版本号

1 设置nginx.conf的http段参数server_tokens;

bear@njava:~/nginx-0.8.34# sudo vi /etc/nginx/nginx.conf

user www-data;
worker_processes  2;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    server_tokens off;
.....

2 重新编译nginx
修改nginx的代码,重新编译

bear@njava:~/nginx-0.8.34/src/http# vi ngx_http_header_filter_module.c 
/*
static char ngx_http_server_string[] = "Server: nginx" CRLF;
static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
*/
static char ngx_http_server_string[] = "Server: njava/4.1.6" CRLF;
static char ngx_http_server_full_string[] = "Server: njava server /4.1.6" CRLF;

Tags: , , ,

星期二, 30 3 月, 2010 服务器 没有评论
1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr