任务:隐藏Nginx、PHP版本号
[root@sky9890 html]# curl -I 101.132.79.69/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Mon, 16 Apr 2018 03:26:32 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.27
隐藏Nginx版本号:
在nginx配置文件nginx.conf中,http{...}中加入以下代码
http {
server_tokens off;
}
[root@sky9890 conf]# curl -I 101.132.79.69
HTTP/1.1 200 OK
Server: nginx #隐藏了版本号
Date: Mon, 16 Apr 2018 03:31:17 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.27
php中隐藏版本号的方法:
在php配置文件php.ini中,修改如下:
[root@sky9890 lib]# vi /usr/local/php/lib/php.ini
expose_php = On #expose_php = Off
[root@sky9890 /]# killall php-fpm
[root@sky9890 /]# /usr/local/php/sbin/php-fpm #重新启动此服务
[root@sky9890 conf]# curl -I 101.132.79.69
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 16 Apr 2018 03:31:17 GMT
Content-Type: text/html
Connection: keep-alive
#没有显示php版本信息了
原文地址:http://blog.51cto.com/sky9896/2103980