天天看點

隐藏nginx 版本号

 ​

HTTP/1.1 200 OK

Server: nginx/0.8.31Date: 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

可以不顯示不?

當然可以

#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(要看你是什麼配置檔案名) 

fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

改為

fastcgi_param SERVER_SOFTWARE nginx;

nginx重新加載配置就完成了 404 501等頁面都不會顯示nginx版本 太棒了

#curl --head 127.0.0.1

Server: nginx

Date: Wed, 13 Jan 2010 06:25:01 GMT

Content-Length: 793

Last-Modified: Sat, 12 Dec 2009 02:28:16 GMT

上一篇: nginx.conf

繼續閱讀