1. How to hide the header version information of nginx
Edit the nginx. conf configuration file and add the following line to http {}:
Copy codeThe Code is as follows: http {
......
Server_tokens off;
......
}
Edit the php-fpm configuration file, fastcgi. conf or fcgi. conf.
Find:
Copy codeThe Code is as follows: fastcgi_param SERVER_SOFTWARE nginx/$ nginx_version;
Changed:
Copy codeThe Code is as follows: fastcgi_param SERVER_SOFTWARE nginx;
Restart nginx to take effect
Copy codeThe Code is as follows: [root @ xmydlinux conf] # curl -- head 127.0.0.1
HTTP/1.1 200 OK
Server: nginx
Content-Type: text/html; charset = UTF-8
Connection: keep-alive
............
2. apache hides the header version information
Edit the httpd. conf file
Find:
Copy codeThe Code is as follows: ServerTokens OS
ServerSignature On
To:Copy codeThe Code is as follows: ServerTokens ProductOnly
ServerSignature Off
Restart the httpd service to take effect.
Copy codeThe Code is as follows: [root @ xmydlinux ~] # Curl-I 127.0.0.1
HTTP/1.1 200 OK
Server: Apache
Accept-Ranges: bytes
Content-Length: 97
Connection: close
Content-Type: text/html
You can also change the file ap_release.h in the include directory of the source code.
Copy codeThe Code is as follows: # define AP_SERVER_BASEVENDOR "Apache Software Foundation" # apache-related words can be changed
# Define AP_SERVER_BASEPROJECT "Apache HTTP Server"
# Define AP_SERVER_BASEPRODUCT "Apache"
# Define AP_SERVER_MAJORVERSION_NUMBER 2 # The version field can be changed at will
# Define AP_SERVER_MINORVERSION_NUMBER 2
# Define AP_SERVER_PATCHLEVEL_NUMBER 17
# Define AP_SERVER_DEVBUILD_BOOLEAN 0
3. PHP version header file hiding and returning
Modify the php. ini file
Find:
Copy codeThe Code is as follows: expose_php = On
To:Copy codeThe Code is as follows: expose_php = Off
You can avoid returning "X-Powered-By: PHP/5.2.17" in the http header ..