InBlock.gif有时候某某版本的服务器可能会爆一些漏洞,***就会用工具扫描你的服务器软件版本,发现如果是存在漏洞的版本的话就会把你定为***对象,所以隐藏服务器的版本号也是一种服务器安全措施。下面我就教大家如何隐藏服务器的本版号: 转载地址:http://www.pc-pub.com/article-956-1.html
InBlock.gif
InBlock.gifNginx的配置文件修改如:(一般在/usr/local/nginx/conf/nginx.conf)
InBlock.gif
InBlock.gif http {
InBlock.gif......                                                            //省略配置
InBlock.gifsendfile on;
InBlock.giftcp_nopush on;
InBlock.gifkeepalive_timeout 65;
InBlock.giftcp_nodelay on;
InBlock.gifserver_tokens off;
InBlock.gif.......                                                    //省略配置
InBlock.gif}
InBlock.gif
InBlock.gif修改后重启nginx:
InBlock.gif
InBlock.gif#nginx /usr/local/nginx/sbin/nginx -s reload
InBlock.gif
InBlock.gif修改前后情况对比:
InBlock.gif
InBlock.gif[root@localhost ~]# curl --head 127.0.0.1
InBlock.gifHTTP/1.1 403 Forbidden
InBlock.gifServer: nginx/0.8.46
InBlock.gifDate: Fri, 11 Mar 2011 08:26:51 GMT
InBlock.gifContent-Type: text/html; charset=utf-8
InBlock.gifContent-Length: 169
InBlock.gifConnection: keep-alive
InBlock.gif
InBlock.gif
InBlock.gif                    
InBlock.gif[root@localhost ~]# curl --head 127.0.0.1
InBlock.gifHTTP/1.1 403 Forbidden
InBlock.gifServer: nginx
InBlock.gifDate: Fri, 11 Mar 2011 08:26:58 GMT
InBlock.gifContent-Type: text/html; charset=utf-8
InBlock.gifContent-Length: 162
InBlock.gifConnection: keep-alive
InBlock.gif
InBlock.gif如果你服务器跑的是nginx+php-fpm,还得编辑php-fpm配置文件,如fcgi.conf、fastcgi.conf(在路径/usr/local/nginx/conf/),查看403报错的时候有没有泄露nginx的版本信息:
InBlock.gif
InBlock.giffastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
InBlock.gif            
InBlock.gif改为
InBlock.gif
InBlock.gif fastcgi_param SERVER_SOFTWARE nginx;
InBlock.gif
InBlock.gif最后重启nginx:/usr/local/webserver/nginx/sbin/nginx -s reload