Подключение защиты Botguard
Интеграция с BitrixVM
Обновите пакет bx-nginx до последней версии.
yum update bx-nginx
Импортируйте GPG ключ.
rpm --import https://repo.botguard.net/botguard.gpg
Добавьте репозиторий BotGuard.
yum-config-manager --add-repo https://repo.botguard.net/BotGuard.repo
Установите модуль nginx-mod-botguard.
yum install --disablerepo botguard --enablerepo botguard-bitrix nginx-mod-botguard
Что бы включить модуль, добавьте первой строкой в конфигурационный файл /etc/nginx/nginx.conf :
load_module /usr/lib64/nginx/modules/ngx_botguard_module.so;
Сделайте тест конфигурации.
nginx -t ### Тест должен пройти без ошибок! nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Переместите файл конфигурации 50-botguard.conf в /etc/nginx/bx/settings/
mv /etc/nginx/conf.d/50-botguard.conf /etc/nginx/bx/settings/
Отредактируйте файл конфигурации /etc/nginx/bx/settings/50-botguard.conf, чтобы активировать защиту.
Раскомментируйте и пропишите настройки:
botguard_primary_server ru-msk-mp1.botguard.net;
botguard_secondary_server ru-msk-mp2.botguard.net;
botguard_check on;
Если у вас несколько сайтов, то необходимо удалить директиву botguard_check on; и перенести её в конфигурацию сайта, к которому подключен тариф защиты.
# The primary BotGuard server address. # Uncomment and replace "xxx.botguard.net" with address # of the primary Botguard server assigned to your website # botguard_primary_server ru-msk-mp1.botguard.net; # The secondary BotGuard server address. # Uncomment and replace "yyy.botguard.net" with address # of the secondary Botguard server assigned to your website # botguard_secondary_server ru-msk-mp2.botguard.net; # Enable or disable caching of bot challenge results. # Uncomment and set to "on" to enable caching. It saves # the traffic, but distorts the BotGuard statistics # # botguard_cache_results off; # The regular expression of skipped URIs # By default, the static resources (images, fonts, styles, etc.) # don't checked by BotGuard. If you have additional types to # bypass checks, uncomment and modify the regular expression. # # botguard_skip "\/.*[^\/]\.(css|js|jpe?g|gif|png|svg|ico|ttf|woff2?|eot|otf|ogg|mp3|mp4|mpg|avi|mov|flv|swf)(\?|$)"; # Enable or disable BotGuard service # By default the module is disabled. Uncomment the line below # to turn on the website protection. # botguard_check on; # Multithreading support greatly increases the module performance # Comment out the line below if your system doesn't support threads. # # aio threads;
Ещё раз выполните проверку конфигурации и перезапустите nginx.
nginx -t && nginx -s reload