[Nitro] SCGI

George Moschovitis george.moschovitis at gmail.com
Mon Oct 2 09:36:22 EDT 2006

Dear devs,

lately I have made some changes in the way one starts and manages
Nitro servers. Let me explain in this email how I use nitro with the
scgi adapter.

The setup goes like this. There is one front web server (lighttpd or
apache or something similar) that handles static content and acts as a
proxy for dynamic content. Attached to this email is an example
lhttpd.conf file to demonstrate  the proxy setup.

Behind this server runs a cluster of nitro servers that handle the
dynamic request. As an example, to start a cluster of 2 nitro servers
using the scgi adapter, go to the application directory and use the

nitro --live --scgi --daemon --cluster 2

for more details consult the file nitro/bin/nitro in the distribution.

The nitro command uses the CONFIGURATION_MODE env variable, so for
example you can set


in your development server and


in your production server.

you can also set

Nitro.adapter = :webrick

in conf/debug.rb


Nitro.adapter = :scgi

in conf/live.rb

etc, etc

Please notice that the nitro command will automatically try to execute
the state.rb file in the same directory. This file is typically
responsible for starting distributed state servers (for example
sessions, global variables etc etc) you may need in process models
like scgi. An example state.rb is also attached.

To stop the server you can use

nitro stop


nitro kill (this also kills the state server)

There are some bad news though. There seem to be some slowdowns if the
nitro server runs behind a proxy. I will investigate and fix it, but
If anyone has any idea please let me know. I have also contacted Zed
about this, perhaps he will be able to help.

If you have more questions, please let me know.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: lhttpd.conf
Type: application/octet-stream
Size: 505 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20061002/e42be9da/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: state.rb
Type: application/x-ruby
Size: 528 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20061002/e42be9da/attachment.bin 

More information about the Nitro-general mailing list