#拒絕user-agent爲Go的訪問返回403並且不記錄日誌
location / {
if ($http_user_agent ~* Go) {
access_log off;
return 403;
}
#訪問後綴是.php等擴展名結尾的頁面時返回403
location ~* \.(ini|cfg|dwt|lbi|php|zip|rar)$ {
return 403;
}
#nginx訪問限速
在http標籤中增加以下內容
limit_req_zone $binary_remote_addr zone=one:20m rate=20r/s;
limit_conn_zone $binary_remote_addr zone=addr:20m;
在server標籤中增加以下內容
limit_conn addr 20;
limit_req zone=one burst=5 nodelay;