This is how you can do it in Aapanel:
wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O /usr/local/sbin/install-ngxblocker
chmod +x /usr/local/sbin/install-ngxblocker
/usr/local/sbin/install-ngxblocker -x -c /www/server/nginx/conf -b /www/server/nginx/bots.d
mv /www/server/panel/vhost/nginx/phpmyadmin.conf /root
/usr/local/sbin/setup-ngxblocker -x -m /www/server/nginx/conf/nginx.conf -e conf -w /www/wwwroot -v /www/server/panel/vhost/nginx -c /www/server/nginx/conf -b /www/server/nginx/bots.d
mv /root/phpmyadmin.conf /www/server/panel/vhost/nginx/
sed -i 's/limit_conn_zone $server_name zone=perserver:10m;/limit_conn_zone $server_name zone=addr:10m;/' /www/server/nginx/conf/nginx.conf
nginx -t
/usr/local/sbin/update-ngxblocker -c /www/server/nginx/conf -b /www/server/nginx/bots.d -e your@email.com
After you do this you need to restart Nginx from the panel, for some reason restarting from shell did not work for me.