Linux服务器中隐藏PHP版本 禁止浏览目录
11 年 ago jony Linux服务器中隐藏PHP版本 禁止浏览目录已关闭评论
默认上expose_php默认是开的。关闭“expose_php”参数可以使php隐藏它的版本信息。
- [root@centos66 ~]# vi /etc/php.ini
在你的php.ini, 定位到含有expose_php的那行把On设成Off:
- expose_php = Off
如果使用 Nginx 服务器,请在 http 段内加入server_tokens off; 配置。
重启apache/nginx即可
隐藏和伪装Apache的版本
去除Apache版本号的方法是修改配置文件/etc/httpd.conf。找到关键字ServerSignature,将其设定为:
ServerSignature Off ServerTokens Prod |
然后重新启动Apache服务器。
或者
在网站的主目录下写入一个.htaccess文件,内容有:
引用
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
#
<IfModule mod_rewrite.c>
RewriteEngine on
# RewriteRule index.html$ index.php
RewriteRule index-([1-9]+[0-9]*).html$ index.php?p=$1
RewriteRule ([a-z]{1,})-([0-9]{1,}).html$ index.php?action=$1&id=$2
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
#
<IfModule mod_rewrite.c>
RewriteEngine on
# RewriteRule index.html$ index.php
RewriteRule index-([1-9]+[0-9]*).html$ index.php?p=$1
RewriteRule ([a-z]{1,})-([0-9]{1,}).html$ index.php?action=$1&id=$2
</IfModule>
#
更多设置:
http://netsecurity.51cto.com/art/201312/422647.htm