How to hide the Nginx version and Nginx version _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
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 :...

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.