Completely hide Nginx and PHP versions

Source: Internet
Author: User

Completely hide Nginx and PHP versions
Nginx displays the version number by default. Some time ago, the Nginx Version Vulnerability was exposed on the Internet. If your website can view the Nginx version through curl-I http: // domain name or IP address, the information may be exploited by attackers. From the perspective of website security, hiding Nginx versions is relatively safer.
The specific method is:
1. Enter the Nginx configuration file directory, vim nginx. conf, and add server_tokens off in the http {-} region;
Http {
... Omitted
Sendfileon;
Keepalive_timeout60;
Server_tokens off;
... Omitted
}
2. Edit the configuration file of php-fpm, for example, fastcgi. conf, fastcgi_params, and fcgi. conf. The modification method is as follows:
Find: fastcgi_paramserver_softwarengversion/$ nginx_version;
Changed to: fastcgi_paramserver_softwareng.pdf;
3. reload the nginx configuration file:/usr/local/nginx/sbin/nginx-s reload
Or restart Nginx smoothly:
Find the nginx main process number: ps-ef | grep "nginx: master process" | grep-v "grep" | awk-F ''' {print $2 }'
Kill-HUP nginx master process number
To hide the PHP version, you must modify the PHP configuration file php. ini. The specific process is as follows:
Vim php. ini,
Find expose_php = On
Change to: expose_php = Off
Restart PHP-fpm: pkill PHP-fpm
/Usr/local/php/sbin/php-fpm
In this way, hiding the nginx and PHP versions increases the website security!

Related Article

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.