• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Best practise to optimize a Plesk server with nginx

Azurel

Silver Pleskian
Hello,

I have a 32GB RAM QuadCore Root-Server and user/visitors on my websites reports "500/nginx" and "502/nginx" error-code sites from time to time or images want load and after f5 loaded perfectly. All this problems I dont have before (3 years older server without Plesk/Nginx). So I think I have not correctly setting up my server for plesk/nginx? Can anybody help me here for a better setting? Thank you! :)

MRTG stats

Established TCP Connections
max: 1069
Average: 591
current: 637

Current Processes Running
Max: 229
Average: 204
Current: 212

# top
top - 19:49:38 up 18 days, 17:23, 1 user, load average: 1.09, 0.89, 0.80
Tasks: 225 total, 2 running, 223 sleeping, 0 stopped, 0 zombie
Cpu(s): 8.9%us, 5.2%sy, 0.0%ni, 84.0%id, 1.6%wa, 0.1%hi, 0.3%si, 0.0%st
Mem: 32875680k total, 31226260k used, 1649420k free, 1518552k buffers
Swap: 1023992k total, 85184k used, 938808k free, 24922868k cached

# top
top - 23:24:33 up 19 days, 20:58, 1 user, load average: 0.60, 0.74, 0.78
Tasks: 212 total, 1 running, 211 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.2%us, 2.3%sy, 1.4%ni, 92.4%id, 0.5%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 32875680k total, 32481364k used, 394316k free, 1524636k buffers
Swap: 1023992k total, 92240k used, 931752k free, 26082060k cached


NGINX; /etc/nginx/nginx.conf

keepalive_timeout 65;

"Web Server Settings" for nginx have: "gzip_proxied any;"

====================

APACHE; /etc/httpd/conf

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
</IfModule>

====================

MYSQL; /etc/my.cnf

I have used mysqltuner.pl to optimize:

Code:
query_cache_size        	= 256M
innodb_buffer_pool_size 	= 256M
key_buffer_size       	= 2048M
join_buffer_size		= 2M
thread_cache_size		= 16
table_open_cache		= 2048
#table_definition_cache	= 2048
low_priority_updates		= 1
slow_query_log		= 1
expire_logs_days		= 7
slow_query_log_file		= /var/log/mysql-slow.log
log_error 			= /var/log/mysql-error.log
#long_query_time  		= 25

[mysqldump]
quick
quote-names
max_allowed_packet		= 32M

[isamchk]
key_buffer_size		= 256M

[myisamchk]
key_buffer_size		= 256M

[mysqld_safe]
log-error			= /var/log/mysql-error.log
pid-file			= /var/run/mysqld/mysqld.pid
 
Last edited:
The 500/502 error sites comes all time from nginx and nginx error log says thousand of lines with

[crit] 6470#0: accept4() failed (24: Too many open files)

[alert] 6470#0: *10858294 socket() failed (24: Too many open files) while connecting to upstream, client:

[error] 1808#0: *959229 connect() failed (111: Connection refused) while connecting to upstream, client:

[alert] 1808#0: *10343383 socket() failed (24: Too many open files) while connecting to upstream, client:


<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white">
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>

EDIT:

/etc/nginx/nginx.conf
I have add this line:
# set open fd limit to 30000
worker_rlimit_nofile 30000;

And /var/log/nginx/error.log-xxxxxx stopping writing errors.
 
Last edited:
Back
Top