Posts

Showing posts from July, 2025

Nginx - rate limit for connection from different user agent

Hello.  Trying to set a rate limit for user agent using nginx on the Hestia CP . 1. In http section of the main nginx configuration /etc/nginx/nginx.conf add this code http { ...    map $http_user_agent $limit_bots {       default '';       ~*(yandex|msnbot|yahoo) $binary_remote_addr;    }    limit_req_zone $limit_bots zone=bots:10m rate=40r/m; ... } In the configuration file of the vhost  need add this code server { ...    limit_req zone=bots burst=5 nodelay; ... } PS. source article