# Best configuration for production?

**URL:** <https://www.ruby-forum.com/t/best-configuration-for-production/205348>\
**Category:** NGINX\
**Created:** [April 4, 2011, 11:56pm UTC](https://www.ruby-forum.com/t/best-configuration-for-production/205348 "2011-04-04T23:56:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 4, 2011, 11:56pm UTC](https://www.ruby-forum.com/t/best-configuration-for-production/205348/1 "2011-04-04T23:56:18Z")

</div>

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  
situations:

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  
configured?

What do you use memcached support for on Nginx as apposed to PHP?

Posted at Nginx Forum:

> **[Best configuration for production?](https://forum.nginx.org/read.php?2,188358,188358#msg-188358)**
>
> 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 situations: 1) Dedicated site...
