How to hide the Nginx version number, hide the Nginx version number _php tutorial

Source: Internet
Author: User

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: ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.