拂风的学习笔记

欢迎
得不到的永远在骚动,被偏爱的都有恃无恐
  1. 首页
  2. 软件
  3. wordpress
  4. 正文

wordfence 插件安全优化设置

2022-05-31 444点热度 0人点赞 0条评论

问题描述

wordpress 安装 wordfence 后,插件会提示需要设置优化。弹窗提示备份 .user.ini ,但是在保存后,因权限不足,无法完成优化过程。

We were unable to make changes to the .user.ini file. It’s possible WordPress cannot write to the .user.ini file because of file permissions. Please verify the permissions are correct and retry the installation.

问题在于网站目录 (/home/wwwroot/域名/) 下,wordfence 没有修改 .user.ini 的权限,因此需要手动修改。

优化内容

wordfence 的优化即在 .user.ini 后追加下述内容:

; Wordfence WAF
auto_prepend_file = '/absolute/file/path/to/wordfence-waf.php'
; END Wordfence WAF

其中 /absolute/file/path/to/ 可以在 Wordfence → 工具 → 诊断 → Wordfence Firewall 当前的WAF配置中找到。

解决方法

.user.ini 文件无法直接修改,如要修改需要:

  1. 先执行:chattr -i /网站目录/.user.ini
  2. 可以使用 winscp文件管理 、vim编辑器 或 nano编辑器 进行追加内容。
  3. 修改完成后再执行:chattr +i /网站目录/.user.ini

REF:

[1] https://wordpress.org/support/topic/unable-to-make-changes-to-the-user-ini-file/

[2] https://lnmp.org/faq/lnmp-vhost-add-howto.html#user.ini

标签: 技术总结
最后更新:2022-06-02

D_super

这个人很懒,什么都没留下

点赞

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2021-2023 swin.ltd. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

苏ICP备2022006696号