How to hide the Nginx version and Nginx version. How to hide the Nginx version number, and hide the Nginx version number recently learned a command curl, which contains a parameter-I that shows which server is used by the website, for example: how to hide the Nginx version and Nginx version
Recently I learned a new command curl, which contains a parameter-I to check which server the website uses, for example:
ZhangxiaoliudeMacBook-Pro-2 :~ Zhangxiaoliu $ curl-I http://nginx.org/
HTTP/1.1 200 OK
Server: nginx/1.9.8
Date: Fri, 18 Dec 2015 06:30:33 GMT
Content-Type: text/html; charset = utf-8
Content-Length: 8347
Last-Modified: Wed, 09 Dec 2015 15:07:16 GMT
Connection: keep-alive
Keep-Alive: timeout = 15
ETag: "566843a4-209b"
Accept-Ranges: bytes
We can see that the official version of Nginx is 1.9.8, and each version of nginx may have some vulnerabilities. Therefore, it is safer to hide the version number from a security perspective!
Step 1: modify the nginx configuration file
Vim/usr/local/nginx/conf/nginx. conf, do not execute commands that do not understand !!!), Add server_tokens off after (or before) tcp_nodelay on;
Step 2: modify the php-fpm configuration file
The name of the php-fpm configuration file is fastcgi. conf or fcgi. conf, vim/usr/local/nginx/conf/fastcgi. conf (and nginx. conf in the same directory), run the vim command ":/SERVER_SOFTWARE" and find: fastcgi_param SERVER_SOFTWARE nginx/$ nginx_version; remove "/$ nginx_version ".
Step 3: Restart the nginx service
Service nginx reload (reload uninterrupted service restart, or use/etc/init. d/nginx reload,/etc/init. d/it contains the service startup script and shell script). some people may say that the nginxd reload is not used, but whether nginxd or nginx is used. for details, see/etc/init. d/name of the service startup script in it
Pipeline recently learned a new command curl, which contains a parameter-I to see which server the website uses, such :...