Select Page

全世界隨時隨地都在發生攻擊事件,我這種小站每天也都有上千次的登入嘗試,實在是防不勝防,只能盡量減少被攻擊的機會,在wordpress中,可以先關閉 XML-RPC 就可以少掉9成的攻擊,值得看一下這篇

檢測自己的網站是否有 XML-RPC 服務

首先先測試自己的網站是否有開啟 XML-RPC 服務,可以透過以下 https://你的網址/xmlpc.php ,來檢測是否可以用,例如

https://rain.tips/xmlrpc.php

會看到下面的訊息,代表這個網址是可以工作的

XML-RPC server accepts POST requests only.

關閉 XMLRPC 的方法如下

1.RD,修改佈景主題的 function.php ,加入xmlrpc_enabled

add_filter('xmlrpc_enabled', '__return_false');

2.MIS,IIS和Apache

IIS 修改 web.config

<location path="xmlrpc.php">
<system.webServer>
  <security>
	<ipSecurity allowUnlisted="false">
	  <add ipAddress="127.0.0.1" subnetMask="255.255.255.255" allowed="true" />
	</ipSecurity>
  </security>
</system.webServer>
</location>

Apache 修改 .htaccess

<Files xmlrpc.php>
order deny,allow
deny from all
allow from 127.0.0.1
</Files>

3.Wordpress管理者

安裝外掛 Disable XML-RPC

參考資料
https://ithelp.ithome.com.tw/articles/10272566