Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in the process of setting up a server with 4GB RAM and 2 CPUs. The stack will be CentOS + NGINX + MySQL + PHP (with APC) and spawn-fcgi. It will be used to serve 10 Wordpress blogs, 3 of which receive about 20,000 hits per day. Each Wordpress instance is equipped with the W3 TotalCache.

I have a few variables to play with:

  • NGINX (How many worker_processes, worker_connections, etc)
  • PHP (What parameters in php.ini should I change? What about apc?)
  • Spawn-fcgi (Right now I have 6 php-cgi spawned. How many of them should I have?)

I realize it's hard to tell without testing, but if you could please provide me with some ballpark numbers, that would be helpful too.

share|improve this question

worker_processes usually should be the same as the number of cores. If you have blocking processes (disk_io, long threads, etc), then you can increase that.

worker_processes * worker_connections = max clients

make sure you configure gzip. It probably isn't necessary to configure rcvbuf or backlog for your site, so, I wouldn't worry much about those settings.

As for your php threads, I would probably run 5-10 as you have. If you start getting 502 Gateway connect errors, you might need to increase that.

For php.ini, the default settings should work fine. If you are uploading pictures/media, increase post_max_size and upload_max_filesize for your requirements. APC is pretty much an out of the box config and should work fine.

Since you're using W3 Total Cache, you are also eliminating a number of hits to php, which should put less load on php-cgi anyhow.

share|improve this answer
The equation is wrong. Nginx master process cannot provide even distribution of requests across the workers. Which means, there is a possibility a worker will hit worker_connections limit. So, the multiply of worker_processes and worker_connections must be somewhat higher than expected maximum number of connections. – Alexander Azarov Jun 17 '10 at 7:56
while I do agree, it is a general guideline. You might suggest your change to – user6738237482 Jun 17 '10 at 8:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.