I have a website mounted on a VPS running with CloudFlare and I have been receiving many errors 520 (web server returns an unknown error) and 525 (SSL handshake failed). When reviewing the logs of my server I have noticed a lot of errors in nginx, the error is the following:

2019/07/03 15:24:25 [alert] 6782#0: 2048 worker_connections are not enough

This error appears in the log up to 17 times per minute. The nginx configuration file is the following:

 #user  nginx;
 worker_processes  1;

 #error_log  /var/log/nginx/error.log;
 #error_log  /var/log/nginx/error.log  notice;
 #error_log  /var/log/nginx/error.log  info;

 #pid        /var/run/nginx.pid;

 include /etc/nginx/modules.conf.d/*.conf;

 events {
     worker_connections  2048;

 http {
     include       mime.types;
     default_type  application/octet-stream;

     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
     #                  '$status $body_bytes_sent "$http_referer" '
     #                  '"$http_user_agent" "$http_x_forwarded_for"';

     #access_log  /var/log/nginx/access.log  main;

     sendfile        on;
     #tcp_nopush     on;

     #keepalive_timeout  0;
     keepalive_timeout  65;
     #tcp_nodelay        on;

     #gzip  on;
     #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

     server_tokens off;

     include /etc/nginx/conf.d/*.conf;

 # override global parameters e.g. worker_rlimit_nofile
 include /etc/nginx/*global_params;

Initially the value of worker_connections was 1024 and I have raised it to 2048 but the problem remains the same.

The server has 4GB of RAM and CPU with 4 cores 2.1GHz/core and nginx is working together with apache, configured by the Plesk panel.

My question is, how do you recommend me to solve this problem? I searched in the web and I have not found an answer that convinces me. I am not sure of the recommended maximum values that I can set to worker_processes andworker_connections taking into account the characteristics of the server.

  • Please include your other nginx config is /etc/nginx/conf.d/*.conf – Joshua Chan Dec 9 '19 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.