Os:centos Release 6.9 (Final)
Task: Hide Nginx, PHP version number
[Email protected] html]# curl-i 101.132.79.69/
http/1.1 OK
server:nginx/1.10.3
Date:mon, APR 2018 03:26:32 GMT
Content-type:text/html
Connection:keep-alive
x-powered-by:php/5.3.27
hidden nginx
in nginx configuration file nginx.conf ,http{.}
HTTP {
Server_tokens off;
}
[Email protected] conf]# curl-i 101.132.79.69
http/1.1 OK
Server:nginx #隐藏了版本号
Date:mon, APR 2018 03:31:17 GMT
Content-type:text/html
Connection:keep-alive
x-powered-by:php/5.3.27
How to hide version numbers in PHP:
in the PHP configuration file php.ini in , Modify the following:
[Email protected] lib]# Vi/usr/local/php/lib/php.ini
expose_php = on #expose_php = Off
[Email protected]/]# Killall PHP-FPM
[Email protected]/]#/USR/LOCAL/PHP/SBIN/PHP-FPM #重新启动此服务
[Email protected] conf]# curl-i 101.132.79.69
http/1.1 OK
Server:nginx
Date:mon, APR 2018 03:31:17 GMT
Content-type:text/html
Connection:keep-alive
#没有显示php版本信息了
Hide Nginx and PHP version numbers