diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 9e7e452..c1f6f10 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -51,7 +51,9 @@ http { proxy_cache_path /var/cache/nginx/static_cache levels=1:2 keys_zone=static_cache:10m max_size=2g inactive=90d use_temp_path=off; proxy_cache_path /var/cache/nginx/nextcloud_private_cache levels=1:2 keys_zone=nextcloud_private_cache:20m max_size=1g inactive=15m use_temp_path=off; proxy_cache_path /var/cache/nginx/nextcloud_previews_cache levels=1:2 keys_zone=nextcloud_previews:20m max_size=2g inactive=7d use_temp_path=off; - proxy_cache_path /var/cache/nginx/nextcloud_cache_grupopralog levels=1:2 keys_zone=nextcloud_cache:120m max_size=10g inactive=6h use_temp_path=off; + # Caches for cloud.grupopralog.com.br + proxy_cache_path /var/cache/nginx/nc_static_cache levels=1:2 keys_zone=nc_static_cache:60m max_size=5g inactive=7d use_temp_path=off; + proxy_cache_path /var/cache/nginx/nc_api_cache levels=1:2 keys_zone=nc_api_cache:60m max_size=2g inactive=60m use_temp_path=off; proxy_cache_path /var/cache/nginx/nextcloud_session_cache levels=1:2 keys_zone=nextcloud_session_cache:50m max_size=500m inactive=30m use_temp_path=off; proxy_cache_path /var/cache/nginx/foldertree_cache keys_zone=foldertree_cache:10m levels=1:2 inactive=1m max_size=100m; proxy_cache_path /var/cache/nginx/business_cache keys_zone=business_cache:10m inactive=60m max_size=1g; @@ -71,11 +73,24 @@ http { # Define as 'variáveis' e 'zonas' que os sites podem usar para segurança. map $http_user_agent $is_bad_bot { default 0; - ~*(nikto|sqlmap|wpscan|gobuster|dirbuster|feroxbuster|nessus|nmap|curl) 1; + # Security Scanners & Malicious Tools + ~*(nikto|sqlmap|wpscan|gobuster|dirbuster|feroxbuster|nessus|nmap|masscan|zgrab|censys|shodan) 1; + # Common Crawlers (SEO, etc.) + ~*(Googlebot|AdsBot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|facebot|ia_archiver) 1; + # Aggressive Marketing/SEO Crawlers + ~*(AhrefsBot|SemrushBot|MJ12bot|DotBot|PetalBot|Bytespider|BLEXBot) 1; + # Block curl for non-internal IPs + ~*curl 1; } + + map $is_bad_bot$is_internal $should_block_bot { + default 0; # Default: do not block + "10" 1; # is_bad_bot = 1, is_internal = 0 -> block + } + map $request_uri $is_suspicious_uri { default 0; - ~*(\.env|\.git|/vendor/|/setup\.php|/\.well-known/|/phpmyadmin|/config\.php|composer\.json) 1; + ~*(\.env|\.git|/vendor/|/setup\.php|/phpmyadmin|/config\.php|composer\.json) 1; } map $is_bad_bot$is_suspicious_uri $block_request { default 0; @@ -254,3 +269,4 @@ http { include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } +