set worker_processes to _SERVER["NUMBER_OF_PROCESSORS"]

Igor Sysoev is at
Sat Sep 19 09:44:06 MSD 2009

On Sat, Sep 19, 2009 at 11:21:05AM +0800, Joshua Zhu wrote:

> Hi,
> On Sat, Sep 19, 2009 at 3:01 AM, Ziyad Saeed <myschizobuddy at> wrote:
> > can i set worker_processes to _SERVER["NUMBER_OF_PROCESSORS"]
> > looking in phpinfo there is a server variable that mentions the number of
> > processors
> >
> No, I don't think so. 'worker_processes' is set only during the
> initialization phase. It expects a number rather than a variable.

Yes, it can be set on start time only.
However, you may use variable value (FreeBSD example):

nginx -g "worker_processes `sysctl -n hw.ncpu`;"

Igor Sysoev

More information about the nginx mailing list