1、目录权限设置很重要:能够有效防范黑客上传木马文件.
若是经过 chmod 644 * -R 的话,php文件就没有权限访问了。
若是经过chmod 755 * -R 的话,php文件的权限就高了。
因此就须要分开设置目录权限和文件权限:
php
find /path -type f -exec chmod 644 {} \; //设置文件权限为644
find /path -type d -exec chmod 755 {} \; //设置目录权限为755
设置完成后,再经过命令:chown root:root * -R 将目录和文件的全部者改成root。
这样就更加安全了。
html
进入到phpcms 安装根目录,选取全部文件:
设置数字值为:755,同时选定:选择递归处理子目录,只应用到目录
一样再选择全部文件,数字值为:644,选择递归处理子目录,只应用到文件
若是设置错了,从新再设置就能够了。
2、Linux find命令 查找可疑的木马文件
linux
虚拟主机配置样例:
<VirtualHost *:80>
ServerAdmin root@phpip.com
DocumentRoot /data/wwwroot/www
ServerName www.phpip.com
<Directory /data/wwwroot/www>
Options FollowSymLinks
AllowOverride Options FileInfo
Order allow,deny
Allow from all
php_admin_value open_basedir /data/wwwroot/www/:/var/tmp/
DirectoryIndex index.htm index.html index.php
</Directory>
ErrorLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-error_log 86400 480"
CustomLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-access_log 86400 480" common
</VirtualHost>
四、按天存放apache日志:
参考上面配置文件:
ErrorLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-error_log 86400 480"
CustomLog "| /usr/sbin/rotatelogs /data/logs/%m_%d_www.phpip.com-access_log 86400 480" commonapache
转载:http://www.phpip.com/html/2014/changjianwenti_0430/133.htmlwindows