diff --git a/nodes/knazarovcom/configuration.nix b/nodes/knazarovcom/configuration.nix index 41885ea..e042e7b 100644 --- a/nodes/knazarovcom/configuration.nix +++ b/nodes/knazarovcom/configuration.nix @@ -37,6 +37,13 @@ services.nginx = { enable = true; + commonHttpConfig = '' + map $http_user_agent $limit_bots { + default 0; + ~*(AhrefsBot|PetalBot|bingbot|gptbot|ZoominfoBot|BLEXBot|Bytespider) 1; + ~*(DecompilationBot|Amazonbot|Barkrowler|SeznamBot) 1; + } + ''; virtualHosts = { "knazarov.com" = { enableACME = true; @@ -56,11 +63,25 @@ add_header "Access-Control-Allow-Origin" *; ''; }; + locations."/" = { + extraConfig = '' + if ($limit_bots = 1) { + return 403; + } + ''; + }; }; "vmatveeva.com" = { enableACME = true; forceSSL = true; root = "${pkgs.vmatveevacom}/srv/vmatveeva.com"; + locations."/" = { + extraConfig = '' + if ($limit_bots = 1) { + return 403; + } + ''; + }; }; "matrix.knazarov.com" = { enableACME = true;