If you want to block IP addresses from your website, you can do so with the following nginx configuration, also known as nginx conf.:
# IP block
if ($remote_addr = 12.123.12.123) {
set $block_requests "1";
} if ($block_requests = "1") {
return 403;
}
If you want to set up the nginx config for your site, you can create a new file with the .conf extension on the server in the /data/wordpress/nginx/ directory. To make the settings take effect, restart nginx by running the wp-restart-nginx
command in the command line.
You can view the traffic generated by IP addresses in the site's HTTP traffic statistics reports via the control panel under Tools -> Site Status -> HTTP Traffic Statistics:
If you want to block traffic from an entire country, you can also do this with nginx conf. However, when blocking countries, you should consider the potential disadvantages, such as the visibility of your website in search engines, because blocking an entire country may also prevent search engine crawlers from accessing your website. When blocking countries, it is also a good idea to allow IP addresses related to Seravo's monitoring. Countries can be blocked with the following nginx configuration:
# Block traffic from geo country code ES
if ($http_x_seravo_geo_country_code ~* "(ES)") {
set $block_requests "1";
}
# Seravo monitoring
if ($remote_addr = 2a04:3542:1000:910:7c25:3fff:fe79:23da) {
set $block_requests "0";
}
# Seravo monitoring
if ($remote_addr = 94.237.85.150) {
set $block_requests "0";
}
if ($block_requests = "1") {
return 403;
}
For the settings to take effect, nginx must be restarted by running the wp-restart-nginx
command in the command line. If you have any questions about setting up restrictions, please contact our customer service at [email protected].