[HowTo] Optimize Nginx and PHP-FPM using VestaCP on CentOS
Posted: Tue Sep 11, 2018 7:25 pm
NGINX
Nginx configs are by default located under at /etc/nginx :
Edit Nginx Config :
First :
Once you open the file for edit you need to change this “worker_rlimit_nofile” value :
From :
To :
uncomment the line remove “#”
*Value “65535” can be different on your server
Second :
find the “worker_connections” :
From:
To :
Once you changed this value restart nginx service :
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 :
And change this Values :-
From :
To :
once you saved the config restart PHP-FPM service :
This are the optimal settings which can handle 2000-3000 real time visitor according to your server config very easily even more.
Nginx configs are by default located under at /etc/nginx :
Edit Nginx Config :
Code: Select all
nano /etc/nginx/nginx.conf
Once you open the file for edit you need to change this “worker_rlimit_nofile” value :
From :
Code: Select all
#worker_rlimit_nofile 65535;
Code: Select all
worker_rlimit_nofile 65535;
*Value “65535” can be different on your server
Second :
find the “worker_connections” :
From:
Code: Select all
worker_connections 1024;
Code: Select all
worker_connections 5000;
Code: Select all
service nginx restart
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
From :
Code: Select all
pm.max_children = 4
pm.max_requests = 4000
Code: Select all
pm.max_children = 10
pm.max_requests = 6000
Code: Select all
service php-fpm restart