nginx worker_connections are not enough

I set my nginx for my Mac for developing. However, it goes 500.

I read access log, gosh, about ten thousand access log there.
Then, I read error log, it said:

2018/05/05 15:05:35 [alert] 1346#0: 20000 worker_connections are not enough
2018/05/05 15:05:35 [error] 1346#0: *86966 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /phpinfo.php HTTP/1.0", upstream: "http://127.0.0.1:80/phpinfo.php", host: "127.0.0.1", referrer: "http://127.0.0.1/"

Okay, then, why? I read Stack overflow and netingcn, found that 500 error may because nginx stuck in infinity loop.

I found my nginx.conf, there are two location ~ \.php$ nginx.conf. One is:

location ~ \.php$ {
    proxy_pass   http://127.0.0.1;
}

Looks like it self-reference? So I comment this. Now there's no nginx worker_connections are not enough more.

And, refer How to persistently control maximum system resource consumption on Mac in Unix & Linux Stack Exchange.