nginx: [warn] 2048 worker_connections exceed open file resource limit: 1024

AlphaPrime

Active Member
Aug 23, 2021
42
6
8
Romania
cPanel Access Level
Root Administrator
I have a problem and none of the solutions work that i find on Internet.
Most of the solutions tell me to add worker_rlimit_nofile 65535; in nginx.conf, but this file if I add anything in it... Nginx Manager will not work on restart! With Engintron i had no problems!
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,041
112
118
Houston, TX
cPanel Access Level
Root Administrator
Hello! You need to make nginx configuration changes via custom configuration files rather than directly editing the nginx configuration file. Can you let me know if this article helps?

 

AlphaPrime

Active Member
Aug 23, 2021
42
6
8
Romania
cPanel Access Level
Root Administrator
Hello! You need to make nginx configuration changes via custom configuration files rather than directly editing the nginx configuration file. Can you let me know if this article helps?


If I add worker_rlimit_nofile 65535; in /etc/nginx/conf.d/ea-nginx.conf the Nginx will not restart!
I really don't know how to make this go away "2048 worker_connections exceed open file resource limit: 1024" - where to make the setting
 

AlphaPrime

Active Member
Aug 23, 2021
42
6
8
Romania
cPanel Access Level
Root Administrator
Hello! You need to make nginx configuration changes via custom configuration files rather than directly editing the nginx configuration file. Can you let me know if this article helps?

I have managed to modify the core files of nginx and now it works nginx.conf can have some settings
 

AlphaPrime

Active Member
Aug 23, 2021
42
6
8
Romania
cPanel Access Level
Root Administrator
my nginx.conf if someone needs it



include /etc/nginx/conf.d/modules/*.conf;
user nobody;
worker_processes auto;
worker_rlimit_nofile 65535;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 4096;
}


http {
include /etc/nginx/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;


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

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";

}
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,041
112
118
Houston, TX
cPanel Access Level
Root Administrator
It sounds like you're still trying to modify the main nginx.conf file, which won't work properly as changes will be overwritten.


Please note the following.

Global configuration
Place any global .conf files that you create in the /etc/nginx/conf.d/ directory.

If you want to adjust every server block on your server, create your .conf file in the /etc/nginx/conf.d/server-includes/ directory.

Note:
Make certain that you also reference your .conf file with an include directive in the file that you want to use it in.
You will need to create a custom conf file as stated above. Please let me know if this helps!
 

HostNoc

Well-Known Member
Feb 20, 2020
157
38
28
Ontario
cPanel Access Level
Root Administrator
HI

You need to make changes in site Niginx configuration file like /etc/nginx/testnginx.conf likefollowing

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

Let me know if this helps
 

Bidi

Well-Known Member
Oct 3, 2012
119
15
68
Romania, Transilvania
cPanel Access Level
DataCenter Provider
HI

You need to make changes in site Niginx configuration file like /etc/nginx/testnginx.conf likefollowing

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

Let me know if this helps

Not working.


nginx: [emerg] "worker_processes" directive is not allowed here in /etc/nginx/conf.d/newnginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

nginx: [emerg] "worker_rlimit_nofile" directive is not allowed here in /etc/nginx/conf.d/newnginx.conf:1