为了安全要将Apache及 PHP 的版本隐藏,可以用以下方法:
Apache:
开启 httpd.conf,加入以下两行:
ServerTokens ProductOnly
ServerSignature Off
PHP:
隐藏 PHP 版本就是隐藏 "X-Powered-By: PHP/5.1.2-1+b1" 这个,开启 php.ini,加入: expose_php = Off 完成以上两个设定后,重新启动 Apache 即可。
另外,讲几个最基本的php的安全设置
disable_functions = system,exec,shell_exec,passthru,popen,dl,phpinfo
display_errors = Off
allow_url_fopen = Off
safe_mode = On
open_basedir = /usr/local/httpd/htdocs/dir1:/usr/local/httpd/htdocs/dir2
#目录权限控制,dir1中的php程序就无法访问dir2中的内容。反过来也不行
lighttpd:
server.tag
set the string returned by the Server: response header
Default: lighttpd
Example: server.tag = "Apache/1.3.29 (Unix) mod_perl/1.29 PHP/4.4.1 mod_ssl/2.8.16 OpenSSL/0.9.7g"
前段参考:
http://www.php-oa.com/2008/01/07/php-apache/
后段参考:
http://trac.lighttpd.net/trac/wiki/server.use-tagDetails
本文作者:佚名 来源:本站原创
CIO之家 www.ciozj.com 微信公众号:imciow