隐藏版本号
可以使用
curl -l http://192.168.10.102
#IP地址用自己的
来查看nginx版本。
隐藏nginx版本号有两个方法
修改主配置文件
vim /usr/local/nginx/conf/nginx.conf
打开以后找到
http {
server_tokens off;
}
前面有#号删了就行
用
nginx -t
查看,看到
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
就说明没有报错。
现在在次访问就可以看到ninex的版本号就被隐藏了。
修改用户和组
编译nginx时指定用户和组,就是配置nginx时,在./configure后面跟上参数,如下
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_gunzip_module --with-http_gzip_static_module \
--with-http_stub_status_module && make && make install
配置用户和组
修改nginx配置文件nginx指定用户与组