0

I'm limiting number of simultaneous connections from one $remote_user to n using conn_limit It works like a charm. However, I will be thrilled to find a way to add exceptions to this. I want user to be able to get *.jpg and *.sql files in as many connections as she wants but still limit *.zip files to just one connection per user. I've been trying to find a solution in nginx docs for a while now without any success. Please point me in a right direction.

My config at the moment:

limit_conn_zone $remote_user zone=limit:10m;

   server {
    location /source {
      root /home/frog/source/;
      auth_basic "Login";
      auth_basic_user_file /home/frog/.htpasswd;
      limit_conn limit 5;
     }

1 Answers1

0

Something like that should work

location /source {
  root /home/frog/source/;
  auth_basic "Login";
  auth_basic_user_file /home/frog/.htpasswd;

  location ~ "\.zip$" {
    limit_conn limit 1;
  }
}
Alexey Ten
  • 7,922
  • 31
  • 35