gistfile1.txt
· 2.8 KiB · Text
Raw
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name git.softwarelibre.mx;
#root /srv/www/html/letsencrypt/public;
# ssl
ssl_certificate "/etc/letsencrypt/live/git.softwarelibre.mx/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/git.softwarelibre.mx/privkey.pem";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
# include
include include.d/letsencrypt.conf;
location = / {
limit_conn cons 5;
limit_req zone=slow delay=5 ;
include include.d/forgejo-proxy.conf;
}
# Default con límite apretado para no sobrecargar de 404s al Forgejo
location / {
limit_conn cons 5;
limit_req zone=crawler delay=5 burst=15 ;
include include.d/forgejo-proxy.conf;
}
location /api {
limit_conn cons 3;
limit_req zone=slow delay=5 burst=15 ;
include include.d/forgejo-proxy.conf;
}
# Aquí debe haber solo elementos estáticos
location ~ ^/(assets|avatars) {
limit_conn cons 5;
limit_req zone=reqs delay=5 burst=55 ;
include include.d/forgejo-proxy.conf;
}
# Rutas de consulta con un límite holgado
location ~ ^/(issues|explore|milestones|notifications|pulls) {
limit_conn cons 3;
limit_req zone=slow delay=5 burst=15 ;
include include.d/forgejo-proxy.conf;
}
# Rutas de administración con límite todavía utilizable
location ~ ^/(admin|org|repo|user) {
limit_conn cons 3;
limit_req zone=slowest delay=5 burst=15 ;
include include.d/forgejo-proxy.conf;
}
# Donde hay repos, un límite más holgado
location ~ ^/(DBS|MxOS|SoftwareLibreMx|KBrown|imcsk8) {
limit_conn cons 5;
limit_req zone=slow delay=5 burst=15 ;
#limit_req zone=crawler delay=5 burst=55 ;
#limit_conn cons 1;
#limit_req zone=crawler ;
include include.d/forgejo-proxy.conf;
}
# Aquí es donde están atacando, límite máximo
location ~ ^/strepsirrhini {
#return 502;
limit_conn cons 5;
limit_req zone=bot delay=5 burst=55 ;
#limit_conn cons 1;
#limit_req zone=bot ;
include include.d/forgejo-proxy.conf;
}
}
| 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 | |
| 82 |