Nginx Web Server
BotGuard provides the integration module for Nginx web server via operating systems package repository. We support the following operating systems:
- Debian 12 ("bookworm"), 11 ("bullseye"), 10 ("buster"), 9 ("stretch")
- Ubuntu 24.04 ("noble"), 22.04 ("jammy"), 20.04 ("focal"), 18.04 ("bionic"), 16.04 ("xenial")
- RHEL/CentOS 9, 8, 7, 6
The integration procedure depends on the type of operating system used
Debian, Ubuntu
Module Installation
The version of the BotGuard Nginx extension module must match with the version of Nginx server installed. In addition to the versions from the system repository,which may be outdated, the Nginx assemblies with the current version of the web server from the nginx.org repository are often used. First of all, you should determine the version of Nginx installed on your system, and from which repository you got it. Depending on this, the installation procedure may differ slightly. Use the following command to get this information:
Note
We assume you are using the root
account (use sudo -s
or su -
if necessary).
As a result of executing this command, a list of Nginx versions available for installation will be displayed. Version installed at the moment, will be marked with asterisks:
nginx:
Installed: 1.14.2-2+deb10u2
Candidate: 1.14.2-2+deb10u2
Version table:
1.18.0-5 90
90 http://deb.debian.org/debian unstable/main amd64 Packages
*** 1.14.2-2+deb10u2 500
500 http://deb.debian.org/debian buster/main amd64 Packages
100 /var/lib/dpkg/status
1.14.2-2+deb10u1 500
500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
http://nginx.org/packages/debian
, then use the nginx repositoryhttp://nginx.org/packages/mainline/debian
, then use the nginx-mainline repositoryhttp://download.ispsystem.com/repo/debian
, then use the nginx repositoryhttp://ppa.launchpad.net/ondrej/nginx-mainline/ubuntu
, then use the ondrej-mainline repository- Otherwise use the main repository
Import the BotGuard package digital signature key:
Import the BotGuard package digital signature key:
Import the BotGuard package digital signature key:
Import the BotGuard package digital signature key:
Install the BotGuard Nginx extension module:
Make sure the Nginx configuration is ok: Restart the Nginx service: Make sure BotGuard module is loaded successfully: As a result of executing this command, the following text should be displayed: and restart the Nginx service:Setting module parameters
After installation, the module will be disabled, as it requires preliminary configuration for its operation. To configure the module, run the command:
Using this command, you can configure the module settings parameters in interactive mode.Instead, you can change the settings of the module by editing its configuration file /etc/nginx/conf.d/50-botguard.conf
:
- Find the line
# botguard_primary_server xxx.botguard.net;
and remove the "#" character (uncomment the line). Replacexxx.botguard.net
with the address of the primary BotGuard server assigned to your web server. - Find the line
# botguard_secondary_server yyy.botguard.net;
and remove the "#" character (uncomment the line). Replaceyyy.botguard.net
with the address of the secondary BotGuard server. - To enable BotGuard protection for all the domains, find the line
# botguard_check on;
and remove the "#" character (uncomment the line). - Reload Nginx config after saving changes:
Diagnostic messages and error messages are logged to the /var/log/nginx/error.log
file, depending on Nginx settings.
RHEL, CentOS
Module Installation
The version of the BotGuard Nginx extension module must match with the version of Nginx server installed. In addition to the versions from the system repository,which may be outdated, the Nginx assemblies with the current version of the web server from the nginx.org repository are often used. First of all, you should determine the version of Nginx installed on your system, and from which repository you got it. Depending on this, the installation procedure may differ slightly. Use the following command to get this information:
Note
We assume you are using the root
account (use sudo -s
or su -
if necessary).
As a result of executing this command, a list of Nginx versions installed and available for installation will be displayed:
Import the BotGuard package digital signature key:
Add the BotGuard repository to the system repositories: Install the BotGuard Nginx extension module: Lock installed module version:Import the BotGuard package digital signature key:
Add the BotGuard repository to the system repositories: Install the BotGuard Nginx extension module: Lock installed module version:Import the BotGuard package digital signature key:
Add the BotGuard repository to the system repositories:yum install yum-utils yum-plugin-versionlock
yum-config-manager --add-repo https://repo.botguard.net/BotGuard.repo
Make sure the Nginx configuration is ok:
Restart the Nginx service: Make sure BotGuard module is loaded successfully: As a result of executing this command, the following text should be displayed: In case the command output is empty (for example when Nginx is installed from nginx.org), then you need to add the following line at the very beginning of the main Nginx configuration file/etc/nginx/nginx.conf
:
and restart the Nginx service:
Setting module parameters
After installation, the module will be disabled, as it requires preliminary configuration for its operation. To configure the module, edit its config file etc/nginx/conf.d/50-botguard.conf
:
- Find the line
# botguard_primary_server xxx.botguard.net;
and remove the "#" character (uncomment the line). Replacexxx.botguard.net
with the address of the primary BotGuard server assigned to your web server. - Find the line
# botguard_secondary_server yyy.botguard.net;
and remove the "#" character (uncomment the line). Replaceyyy.botguard.net
with the address of the secondary BotGuard server. - To enable BotGuard protection for all the domains, find the line
# botguard_check on;
and remove the "#" character (uncomment the line). - Reload Nginx config after saving changes:
Diagnostic messages and error messages are logged to the /var/log/nginx/error.log
file, depending on Nginx settings.