Hide Nginx and PHP version numbers in Linux

Source: Internet
Author: User

Nginx Hide Version Number:

1, enter the Nginx configuration file directory (this directory according to the installation decision), with the nano edit open

Nano nginx.conf

Add Server_tokens off in HTTP {-}; Such as:

HTTP {
...... Omitted
Sendfile on;
Tcp_nopush on;
Keepalive_timeout 60;
Tcp_nodelay on;
Server_tokens off;
... omit.
}

2, edit php-fpm configuration file, such as fastcgi.conf or fcgi.conf (this profile name can also be customized, according to the specific file name modified):
Found it:


Fastcgi_param server_software nginx/$nginx _version;

To

Fastcgi_param Server_software Nginx;

3, Reload Nginx configuration:

/etc/init.d/nginx Reload

This completely hides the Nginx version number, that is, 404, 501 and other pages will not show the Nginx version.

PHP Hidden version Number:

PHP.ini expose_php = on to expose_php = off is done

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.