关闭Nginx显示版本信息

Nginx 会在 http 头,或者出现错误页的时候会有醒目的版本号提示。
为了安全,可以关闭这些信息。以下为关闭Nginx显示版信息的设置。
方法很简单,只需在 nginx.conf 的 http { 里头加入 server_tokens 加的参数,文字加粗的部分。
重启Nginx以后就可以看到效果了。
例如:

http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
}

Published by

@XiaoKyun

双鱼男,过分热心的好人。