Last update at :2024-07-12,Edit by888u
Many times if we deliberately learn a certain skill, we really don’t know where to start. Many times we find problems and then look for solutions. This is also true when we learn and use VPS. Yesterday, I don’t know if it was man-made or it hit a snail. A linode machine was attacked by CC for one day starting from the night before yesterday. The difference from the past was not from one or a few fixed IPs, but from countless IPs simulating Googlebot access. As a result, linode sent me a report email that the CPU exceeded the standard by up to 800%.
I have also seen other tutorials on preventing CC attacks on the Internet, but I have not tested them. I will test them later. I will first block the USER AGENT tag from the .htaccess file. Of course, I will use this article to sort out all the htaccess file usage skills encountered before and later, and will not start another article.
Related content previously shared:
Supplementary htaccess file solution to the problem of WordPress occupying too much resources Apache environment. htaccess pseudo-static 301 jump (www and without www) Typecho program pseudo-static rules (Linux/Windows)
Article Directory Hide
First, block spiders
Second, customize the error page
Third, file anti-hotlinking
First, block spiders
We can find the \\"HTTP_USER_AGENT\\" identifier from the website logs and then block it.
RewriteEngine OnRewriteCond %{HTTP_USER_AGENT} ^AbcdRewriteRule ^.* - [F,L]The above is to block all accesses with Abcd spiders in the logo and perform 403 jump blocking
RewriteCond %{HTTP_USER_AGENT} (baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot) [NC]RewriteRule .* - [F]The above can block search engine spiders according to your own choice, separated by | vertical bars.
Second, customized error page
Generally used to customize error 404 pages, etc.
ErrorDocument 404 /error/404.phpErrorDocument 500 /error/500.phpErrorDocument 400 /error/400.phpErrorDocument 401 /error/401.phpErrorDocument 403 /error/403.phpErrorDocument 503 /error/503.phpThird, file anti-hotlinking
RewriteEngine onRewriteCond %{HTTP_REFERER} !^$ [NC]RewriteCond %{HTTP_REFERER} !google.com [NC]RewriteCond %{HTTP_REFERER} !baidu.com [NC]RewriteCond %{HTTP_REFERER} !feedburner.com [NC]RewriteCond % {HTTP_REFERER} !feedsky.com [NC]RewriteRule .*.(gif|jpg|png)$ http://laozuo.org/forbidden.gif [R,NC,L]The file is protected against hotlinking, and then all pictures are displayed to another picture.
Anyway, I’ll sort out other related stuff later when I have time.
Recommended site searches: cloud server rental, website registration information website registration and cancellation, free ip proxy server, online server website, virtual space host, Hong Kong high-defense server rental, domain name registrar Alibaba Cloud domain name registration entrance, registration-free space free net,
发表评论