# Set worker\_processes to \_SERVER

**URL:** <https://www.ruby-forum.com/t/set-worker-processes-to-server/175744>\
**Category:** NGINX\
**Created:** [September 18, 2009, 9:11pm UTC](https://www.ruby-forum.com/t/set-worker-processes-to-server/175744 "2009-09-18T21:11:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![myschizobuddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@myschizobuddy](https://www.ruby-forum.com/u/myschizobuddy)\
**Post date:** [September 18, 2009, 9:11pm UTC](https://www.ruby-forum.com/t/set-worker-processes-to-server/175744/1 "2009-09-18T21:11:03Z")

</div>

can i set worker\_processes to \_SERVER[“NUMBER\_OF\_PROCESSORS”]  
looking in phpinfo there is a server variable that mentions the number  
of  
processors

---

<div class="post-metadata">

**Author:** ![myschizobuddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@myschizobuddy](https://www.ruby-forum.com/u/myschizobuddy)\
**Post date:** [September 19, 2009, 5:30am UTC](https://www.ruby-forum.com/t/set-worker-processes-to-server/175744/2 "2009-09-19T05:30:55Z")

</div>

Hi,

On Sat, Sep 19, 2009 at 3:01 AM, Ziyad S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.

Regards,

---

<div class="post-metadata">

**Author:** ![myschizobuddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@myschizobuddy](https://www.ruby-forum.com/u/myschizobuddy)\
**Post date:** [September 19, 2009, 7:51am UTC](https://www.ruby-forum.com/t/set-worker-processes-to-server/175744/3 "2009-09-19T07:51:57Z")

</div>

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

> Hi,
> 
> On Sat, Sep 19, 2009 at 3:01 AM, Ziyad S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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`;”

---

<div class="post-metadata">

**Author:** ![myschizobuddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@myschizobuddy](https://www.ruby-forum.com/u/myschizobuddy)\
**Post date:** [September 19, 2009, 7:52am UTC](https://www.ruby-forum.com/t/set-worker-processes-to-server/175744/4 "2009-09-19T07:52:32Z")

</div>

On Sat, Sep 19, 2009 at 12:01:24AM +0500, Ziyad S. 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

On Windows you should use single worker, since Windows routes all  
connections to one process only anyway.
