Page 1 of 1

[HowTo] Optimize Nginx and PHP-FPM using VestaCP on CentOS

Posted: Tue Sep 11, 2018 7:25 pm
by xorro
NGINX

Nginx configs are by default located under at /etc/nginx :

Edit Nginx Config :

Code: Select all

nano /etc/nginx/nginx.conf
First :

Once you open the file for edit you need to change this “worker_rlimit_nofile” value :
From :

Code: Select all

#worker_rlimit_nofile    65535;
To :

Code: Select all

worker_rlimit_nofile    65535;
uncomment the line remove “#”

*Value “65535” can be different on your server

Second :

find the “worker_connections” :

From:

Code: Select all

worker_connections 1024;
To :

Code: Select all

worker_connections 5000;
Once you changed this value restart nginx service :

Code: Select all

service nginx restart
PHP-FPM

By default php-fpm configs are by default located under at /etc/php-fpm.d

when you navigate to this dir you’ll find bunch of configs (domain.com.conf) are located under this dir open the config file for your website and change the value :

open your website domain name config file :

Code: Select all

cd /etc/php-fpm.d
nano your-website-name.com.conf
And change this Values :-

From :

Code: Select all

pm.max_children = 4
pm.max_requests = 4000
To :

Code: Select all

pm.max_children = 10
pm.max_requests = 6000
once you saved the config restart PHP-FPM service :

Code: Select all

service php-fpm restart
This are the optimal settings which can handle 2000-3000 real time visitor according to your server config very easily even more.

Re: [HowTo] Optimize Nginx and PHP-FPM using VestaCP on CentOS

Posted: Sun Aug 25, 2019 1:06 pm
by mlopez
Is it just when one uses only nginx or it also work for nginx + apache?
What are the RAM and CPU config for this values?

Thank you, xorro!