1

Lets say we have a configuration as below:

http {
       limit_conn_zone $binary_remote_addr zone=conn_limit1:12m;
       limit_conn_zone $server_name zone=conn_limit2:24m;
       [...]
       server {
           [...]
           location / {
               limit_conn conn_limit1 5;
               limit_conn conn_limit2 200;
           }
} }

I have a connection limitation per IP and Host. My question is when user request for example: http://www.test.com/index.php, inside of this we include many js img files which are logged inside of access_log as a single request!

Does Nginx limit connections to 5 for that single request or including all those files that are requested? If there are 6 files inside of that index.php then client receives 503 or not?

Alireza
  • 583
  • 4
  • 9
  • 27
  • You're including many files and these get somehow (?) combined into one request in `access_log`? Could you show an example? Curious how this looks like.. – gxx Feb 03 '16 at 09:43
  • @gf_ , no each has its own log inside of nginX. – Alireza Feb 03 '16 at 09:47
  • So, let's say you're including ten files inside your `index.php`, you get ten lines for these files inside your log, when requesting `index.php`, right? – gxx Feb 03 '16 at 09:50
  • @gf_, yes that's right. Now I want to know if those 10 requests is related to this connection limit or not – Alireza Feb 03 '16 at 09:54
  • AFAIK this depends how the client handles the connection(s) and the involved protocol: http/1.1, http/2, spdy etc. (Besides: If you're requesting ten files, this is not a single request, but ten.) Just as a pointer: To limit requests you could use [this](http://nginx.org/en/docs/http/ngx_http_limit_req_module.html) module. – gxx Feb 03 '16 at 10:01
  • The other files are requested inside of index.php, does that mean different requests for nginx? – Alireza Feb 03 '16 at 10:17
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/35226/discussion-between-alireza-hos-and-gf). – Alireza Feb 03 '16 at 10:20

0 Answers0