Best configuration for production?
nginx-forum at nginx.us
Tue Apr 5 01:55:47 MSD 2011
I have set up an installation of Nginx + PHP-FPM. I'm wondering what are
the "best configuration for production" would be to make best use of
resources without overloading the server. I'm interested in these
1) Dedicated site with one user (1 PHP-FPM pool total)
2) Shared virtual host environment (+1 PHP-FPM pool per user)
3) #1 or #2 with / without MySQL on the same server (How much should
MySQL be allotted memory wise? Thinking about using v 5.5.)
Beyond that I know that this will be relative depending on your hardware
(cpu, memory, etc...). But how would you determine this, other than
trial and error?
What I'm particularly interested in set (nginx config) worker_processes,
worker_connections, (php-fpm config) pm.max_children, pm.start_servers,
pm.min_spare_servers, and pm.max_spare_servers.
I'm assuming that worker_processes is set to the number of cores, and
worker_connections is supposed to be `ulimit -n` / worker_processes
(really need to confirm that part). If MySQL or other servers are
installed, do you want to set worker_processes to the number of cores,
or should it be less than that?
With PHP-FPM, assuming PHP's memory is set to 128MB (good number?), what
should be set to for each pool (assuming pm is dynamic)? Should
pm.max_requests even be used?
What options are there as far as load balancing techniques with dynamic
content (php) verses static content (with 1 site)? Proxy? Non-proxy?
Different servers for PHP backends? Roll over to different Ngnix?
Does removing certain modules from compile time make Nginx more
efficient (ones you don't use), or does it just matter how the server is
What do you use memcached support for on Nginx as apposed to PHP?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,188358,188358#msg-188358
More information about the nginx