How to hide the Nginx version number, hide the Nginx version number
Recently learned a new command curl, which has a parameter-I can see what kind of server the site uses, such as:
zhangxiaoliudemacbook-pro-2:~ zhangxiaoliu$ curl-i http://nginx.org/
http/1.1 OK
server:nginx/1.9.8
Date:fri, Dec 06:30:33 GMT
content-type:text/html; Charset=utf-8
content-length:8347
last-modified:wed, 15:07:16 GMT
Connection:keep-alive
Keep-alive:timeout=15
ETag: "566843a4-209b"
Accept-ranges:bytes
Can see the Nginx official version is 1.9.8, each version of Nginx may have some loopholes, so, from a security point of view, the hidden version number will be relatively safe!
First step: Modify Nginx configuration file
Vim/usr/local/nginx/conf/nginx.conf (the path of the configuration file is determined by the installation of Nginx directory, everyone is not the same, because some beginners do not understand will be copied and pasted and then executed, the consequences are serious, for the command do not understand do not do!!! ), tcp_nodelay on; add server_tokens off after (or before);
Step Two: Modify the PHP-FPM configuration file
The name of the PHP-FPM configuration file is called fastcgi.conf or fcgi.conf,vim/usr/local/nginx/conf/fastcgi.conf (and nginx.conf in the same directory), using the VIM command ":/ Server_software", found: Fastcgi_param server_software nginx/$nginx _version; Remove the "/$nginx _version".
Step three: Restart the Nginx service
Service Nginx Reload (reload non-stop service restart, or use/etc/init.d/nginx reload,/etc/init.d/inside are the services startup script, is the shell script), One might say that not using the service Nginxd reload, in the end is the use of nginxd or nginx, specifically to see the name of the services startup script inside the/etc/init.d/
http://www.bkjia.com/PHPjc/1081557.html www.bkjia.com true http://www.bkjia.com/PHPjc/1081557.html techarticle How to hide the version number of Nginx, hide the Nginx version number recently learned a command curl, which has a parameter-I can see what kind of server the site uses, such as: ...