These days, one of my website servers is often heavily loaded. It has a WordPress website installed on it and checks the logs. People often crawl wp-login.php. It is estimated that it is hacker attacks that cause a large number of database accesses to cause excessive load.
WordPress is actually a very common website building tool, which is expected to be used by many people. Let me introduce my solution here.
1. WordPress static
First, implement the whole site static processing for the WordPress website. The plug-in I use is "super static cache", which can realize the static processing of articles and directories.
However, after using the "super static cache" plug-in, the directory and tag will have a redirection problem, that is, it will automatically jump from a directory without "/" to a directory with "/". Although normal browsing is no problem, it is not SEO friendly. It is better to install a plug-in named "permalink trailing flash fixer" to solve the problem of directory redirection.
2. Add firewall rule
After WordPress static processing, normal users should not access php files when visiting websites. At this time, add a firewall to websites. It is recommended to use free cloudflare. Add a rule in the firewall background - "security" - "WAF". When the "full URL" contains "php", execute the firewall's "hosting challenge" operation.
The expression is: http. request. full_uri contains "php"
I actually operated on the host. After deploying the firewall rule, I found that the overall load of the server returned to normal immediately. If you encounter similar problems, you can use the above methods to optimize them.