title: Explain limit_conn_zone $server_name in nginx
body: <p>I am configuring nginx for basic DDoS protection. I want to use the limit_conn module as described in <a href="http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html" rel="nofollow">http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html</a>.
  In particular I do not understand this example:</p>
  
  <pre><code>limit_conn_zone $binary_remote_addr zone=perip:10m;
  limit_conn_zone $server_name zone=perserver:10m;
  
  server {
      ...
      limit_conn perip 10;
      limit_conn perserver 100;
  }
  </code></pre>
  
  <p>The description is: </p>
  
  <blockquote>
    <p>For example, the following configuration will limit the number of connections to the server per a client IP and, at the same time, the total number of connections to the virtual host</p>
  </blockquote>
  
  <p>The first part is clear, I am allowing not more than 10 simultaneous connections from one IP. </p>
  
  <p>But does the second rule mean, that I am only allowing 100 connections to my server? Because if it so, and the attacker just opens ~100 connections it would block <strong>everyone</strong> from accessing the server, effectively making DDoS attack succeed. </p>