Limit Nginx max concurrent connections
<p>I am looking for a way to limit the number of maximum concurrent connections to 1.
I do not want a connection limit per IP, I already know this is supported.</p>

<p>As far as I can see, <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#max_conns" rel="noreferrer">max_conns</a> would be exactly what I'm looking for, but unfortunately it's not available in the free version: </p>

<blockquote>
  <p>Additionally, the following parameters are available as part of our
  commercial subscription</p>
</blockquote>

<p>Limiting <code>worker_connections</code> is not an option, as the minimum it wants is 4, and it affects more than the incoming requests.</p>

<p>My conf:</p>

<pre><code>server {
listen       80;
server_name  localhost;

location / {
rewrite_by_lua '
     [some lua code]
';

    proxy_pass http://127.0.0.1:8080;
 }
}
</code></pre>