隐藏nginx 版本号的方法分享
时间:2014-07-09 20:49 来源:linux.it.net.cn 作者:IT网
在nginx中隐藏其版本号的方法,隐藏掉nginx的版本
查看nginx的版本信息:
# curl --head www.jbxue.com
HTTP/1.1 200 OK
Server: nginx/0.8.31
Date: Wed, 13 Jan 2010 06:17:30 GMT
Content-Type: text/html
Content-Length: 2341
Last-Modified: Mon, 11 Jan 2010 15:45:11 GMT
Connection: keep-alive
Keep-Alive: timeout=15
Accept-Ranges: bytes
以上数据显示:
服务器nginx版本是0.8.31
如何隐藏nginx的版本呢,请参考如下的方法。
#vi nginx.conf
在http 加上 server_tokens off;
复制代码代码示例:
http {
......省略配置
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
server_tokens off;
.......省略配置
}
后续的就是编辑php-fpm配置文件 如fcgi.conf 、fastcgi.conf等了。
重启nginx:
复制代码代码示例:
service nginx restart
再次使用curl查看,是不是版本号不显示了?!
(责任编辑:IT)
在nginx中隐藏其版本号的方法,隐藏掉nginx的版本
查看nginx的版本信息:
# curl --head www.jbxue.com
HTTP/1.1 200 OK Server: nginx/0.8.31 Date: Wed, 13 Jan 2010 06:17:30 GMT Content-Type: text/html Content-Length: 2341 Last-Modified: Mon, 11 Jan 2010 15:45:11 GMT Connection: keep-alive Keep-Alive: timeout=15 Accept-Ranges: bytes
以上数据显示:
如何隐藏nginx的版本呢,请参考如下的方法。
复制代码代码示例:
http {
......省略配置 sendfile on; tcp_nopush on; keepalive_timeout 65; tcp_nodelay on; server_tokens off; .......省略配置 } 后续的就是编辑php-fpm配置文件 如fcgi.conf 、fastcgi.conf等了。
重启nginx:
复制代码代码示例:
service nginx restart
再次使用curl查看,是不是版本号不显示了?! (责任编辑:IT) |