Auto detect the number of CPU's and set worker_processes

Mark Alan varia at
Mon Sep 17 11:34:46 UTC 2012

On Sat, 15 Sep 2012 19:55:49 -0400, "justin" <nginx-forum at>

> I am trying to get fancy and have `nginx.conf` auto-detect

Not knowing how to auto-detect it, I usually just excute this as ROOT:

sed -i '/^worker_processes/s,[0-9]\+,'"$(sort -u /proc/cpuinfo | grep
-c processor)"',' /etc/nginx/nginx.conf

More information about the nginx mailing list