Nginx/apache/php Hide HTTP Header version Information implementation _ Server other

Source: Internet
Author: User

1, Nginx hidden Head version information method

Edit the nginx.conf configuration file and add the following line within http{}

Copy Code code as follows:

HTTP {
......
Server_tokens off;
......
}

Edit PHP-FPM configuration file, fastcgi.conf or fcgi.conf

Found it:

Copy Code code as follows:

Fastcgi_param server_software nginx/$nginx _version;

To

Copy Code code as follows:

Fastcgi_param Server_software Nginx;

Restart Nginx service in effect

Copy Code code as follows:

[Root@xmydlinux conf]# Curl--head 127.0.0.1
http/1.1 OK
Server:nginx
content-type:text/html; Charset=utf-8
Connection:keep-alive
............

2, Apache hidden head version information

Edit httpd.conf File

Found it:

Copy Code code as follows:

Servertokens OS
Serversignature on

Modified to:
Copy Code code as follows:

Servertokens productonly
Serversignature off

Restarting the HTTPD service takes effect

Copy Code code as follows:

[Root@xmydlinux ~]# curl-i 127.0.0.1
http/1.1 OK
Server:apache
Accept-ranges:bytes
content-length:97
Connection:close
Content-type:text/html

Another: Can change the source code include directory ap_release.h this file

Copy Code code as follows:

#define Ap_server_basevendor "Apache Software Foundation" #apache相关字样都可更改
#define Ap_server_baseproject "Apache HTTP SERVER"
#define AP_SERVER_BASEPRODUCT "Apache"

#define Ap_server_majorversion_number 2 #版本字段可随意更改
#define Ap_server_minorversion_number 2
#define Ap_server_patchlevel_number 17
#define Ap_server_devbuild_boolean 0

3, PHP version of the head file hidden return

modifying php.ini files

Found it:

Copy Code code as follows:

expose_php = On

Modified to:
Copy Code code as follows:

expose_php = Off

The

can avoid returning the word "x-powered-by:php/5.2.17" in HTTP header information ...

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.