透過 Nginx 屏蔽 Bots
如果你的網站使用 Nginx,可以在 nginx.conf 加入:
if ($http_user_agent ~* (bot|spider|crawler|curl|wget|python|java|scrapy|Go-http|httpclient|libwww-perl|lwp|urllib|aiohttp)) { return 403; }
這樣所有帶有 bot 或 crawler 的 User-Agent 都會被阻擋。
如果你的網站使用 Nginx,可以在 nginx.conf 加入:
if ($http_user_agent ~* (bot|spider|crawler|curl|wget|python|java|scrapy|Go-http|httpclient|libwww-perl|lwp|urllib|aiohttp)) { return 403; }
這樣所有帶有 bot 或 crawler 的 User-Agent 都會被阻擋。