Each process can handle up to a maximum number of connections, as specified by the worker_connections directive. This defaults to 512, but for systems with high numbers of connections, we can increase this further. To do this, we need to edit the main nginx configuration file (/etc/nginx/nginx.conf) and adjust the following:
events { worker_connections 4096; }
As increasing the maximum number of connections means that additional system resources are required, caution should be exercised when making a change. If the server hits the limit for worker_connections, this will be logged in the NGINX error log. By ensuring that this is monitored alongside server resources, you can ensure that it has been set to the correct limit.