sandino revised this gist 1 month ago. Go to revision
1 file changed, 81 insertions
gistfile1.txt(file created)
| @@ -0,0 +1,81 @@ | |||
| 1 | + | server { | |
| 2 | + | listen 80; | |
| 3 | + | listen [::]:80; | |
| 4 | + | listen 443 ssl; | |
| 5 | + | listen [::]:443 ssl; | |
| 6 | + | http2 on; | |
| 7 | + | server_name git.softwarelibre.mx; | |
| 8 | + | #root /srv/www/html/letsencrypt/public; | |
| 9 | + | ||
| 10 | + | # ssl | |
| 11 | + | ssl_certificate "/etc/letsencrypt/live/git.softwarelibre.mx/fullchain.pem"; | |
| 12 | + | ssl_certificate_key "/etc/letsencrypt/live/git.softwarelibre.mx/privkey.pem"; | |
| 13 | + | ssl_session_cache shared:SSL:1m; | |
| 14 | + | ssl_session_timeout 10m; | |
| 15 | + | ssl_prefer_server_ciphers on; | |
| 16 | + | ||
| 17 | + | # include | |
| 18 | + | include include.d/letsencrypt.conf; | |
| 19 | + | ||
| 20 | + | location = / { | |
| 21 | + | limit_conn cons 5; | |
| 22 | + | limit_req zone=slow delay=5 ; | |
| 23 | + | include include.d/forgejo-proxy.conf; | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | # Default con límite apretado para no sobrecargar de 404s al Forgejo | |
| 27 | + | location / { | |
| 28 | + | limit_conn cons 5; | |
| 29 | + | limit_req zone=crawler delay=5 burst=15 ; | |
| 30 | + | include include.d/forgejo-proxy.conf; | |
| 31 | + | } | |
| 32 | + | ||
| 33 | + | location /api { | |
| 34 | + | limit_conn cons 3; | |
| 35 | + | limit_req zone=slow delay=5 burst=15 ; | |
| 36 | + | include include.d/forgejo-proxy.conf; | |
| 37 | + | } | |
| 38 | + | ||
| 39 | + | # Aquí debe haber solo elementos estáticos | |
| 40 | + | location ~ ^/(assets|avatars) { | |
| 41 | + | limit_conn cons 5; | |
| 42 | + | limit_req zone=reqs delay=5 burst=55 ; | |
| 43 | + | include include.d/forgejo-proxy.conf; | |
| 44 | + | } | |
| 45 | + | ||
| 46 | + | # Rutas de consulta con un límite holgado | |
| 47 | + | location ~ ^/(issues|explore|milestones|notifications|pulls) { | |
| 48 | + | limit_conn cons 3; | |
| 49 | + | limit_req zone=slow delay=5 burst=15 ; | |
| 50 | + | include include.d/forgejo-proxy.conf; | |
| 51 | + | } | |
| 52 | + | ||
| 53 | + | # Rutas de administración con límite todavía utilizable | |
| 54 | + | location ~ ^/(admin|org|repo|user) { | |
| 55 | + | limit_conn cons 3; | |
| 56 | + | limit_req zone=slowest delay=5 burst=15 ; | |
| 57 | + | include include.d/forgejo-proxy.conf; | |
| 58 | + | } | |
| 59 | + | ||
| 60 | + | # Donde hay repos, un límite más holgado | |
| 61 | + | location ~ ^/(DBS|MxOS|SoftwareLibreMx|KBrown|imcsk8) { | |
| 62 | + | limit_conn cons 5; | |
| 63 | + | limit_req zone=slow delay=5 burst=15 ; | |
| 64 | + | #limit_req zone=crawler delay=5 burst=55 ; | |
| 65 | + | #limit_conn cons 1; | |
| 66 | + | #limit_req zone=crawler ; | |
| 67 | + | include include.d/forgejo-proxy.conf; | |
| 68 | + | } | |
| 69 | + | ||
| 70 | + | # Aquí es donde están atacando, límite máximo | |
| 71 | + | location ~ ^/strepsirrhini { | |
| 72 | + | #return 502; | |
| 73 | + | limit_conn cons 5; | |
| 74 | + | limit_req zone=bot delay=5 burst=55 ; | |
| 75 | + | #limit_conn cons 1; | |
| 76 | + | #limit_req zone=bot ; | |
| 77 | + | include include.d/forgejo-proxy.conf; | |
| 78 | + | } | |
| 79 | + | ||
| 80 | + | } | |
| 81 | + | ||
Newer
Older