1,文件夹权限要修改 文件夹755 文件644,如果是虚拟主机,则关闭所有文件夹修改权限
大多数文件应该是644或640,wp-config.php除外,它应该是440或400。
目录应为755或750(从不777)。
sudo find -type d -exec chmod 755 {} \; sudo find -type f -exec chmod 644 {} \;
2,httd http安全设置
3,禁用xml-rpc,删除xmlrpc.php防止暴力破解
functions.php 头部添加
add_filter('xmlrpc_enabled','__return_false');
删除服务器里的xmlrpc.php
验证:
输入:https://www.guhaisheng.cn/xmlrpc.php
不再提示:
XML-RPC server accepts POST requests only.
4,屏蔽文件上传目录。参考apche httpd 安全配置去除Indexes
默认:域名/wp-content/uploads/ 直接暴露所有上传附件
5,去除版本信息删除/var/www/html 下的readme.html
原现象:域名/readme.html 可直接访问相关版本信息
6,?author=1会获取到后台用户名。
以下方法治标不治本,页面和请求中还会带作者信息的。
function.jsp:
function author_archive_redirect() { if( is_author() ) { wp_redirect( home_url()); exit; } } add_action( 'template_redirect', 'author_archive_redirect' );
安装安全插件:
安全插件:Wordfence Security
登录评论添加验证码:Math Captcha
apache httpd 安全相关配置
httpd.conf中去掉Indexes
indexes解释:指定目录页面没有index默认页面,则直接展示目录结构。
默认:Options Indexes FollowSymLinks
改为:Options FollowSymLinks
mysql:
数据库经常崩溃
1,为linux添加swap空间
2,根据mysql启动日志及崩溃日志,优化mysql