添加nginx防止爬虫爬取配置 (#1187)

* 添加nginx防止爬虫爬取配置

* Update nginx.conf

* Update README.md
This commit is contained in:
夜法之书(appotry)
2023-04-24 20:08:30 +08:00
committed by GitHub
parent d598dc65ce
commit 89f78bd4c7
2 changed files with 23 additions and 0 deletions

View File

@@ -3,6 +3,13 @@ server {
server_name localhost;
charset utf-8;
error_page 500 502 503 504 /50x.html;
# 防止爬虫抓取
if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot")
{
return 403;
}
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;