Nginx and SCGI

Hi all,
As far as I know, there’s a SCGI module for Nginx but currently it’s not
compatible with the latest stable version (0.7.64).
I’m working on integrating the Disco MapReduce framework with Nginx,
that’s why SCGI is needed in this case (I still prefer FastCGI anyway).
It would be great if we have a plan to update the source code of
mod_scgi to make it compatible with the new version of Nginx.

Please check attached patch. I made it few months ago for my “proxy vs
fastcgi vs scgi vs wsgi” tests and it seems to work just fine, but
please be
aware that I don’t use it in production (or at all for that matter -
proxy
won ;)).

Best regards,
Piotr S. < [email protected] >

Hi,
Thanks for you patch, I will make a quick test on this.

Just a quick question, there was a known bug noticed on
http://wiki.nginx.org/NginxNgxSCGIModule.
It’s about “Duplicate name are not allowed in this headers” error, did
you experience this bug while testing the modules ?

Regards,
Huy Phan

Just a quick question, there was a known bug noticed on
http://wiki.nginx.org/NginxNgxSCGIModule.
It’s about “Duplicate name are not allowed in this headers” error, did
you experience this bug while testing the modules ?

Nope. You shouldn’t really experience this bug in the wild.

I believe that what author meant by that comment is that “mod_scgi
doesn’t
perform any checks to detect if such header already exists”.

Best regards,
Piotr S. < [email protected] >

Piotr S. wrote:

few months ago for my “proxy vs fastcgi vs scgi vs wsgi” tests

Against what application framework did you run the tests?
Did you publish the results anywhere?
By what measure did proxy win?

Tobia

few months ago for my “proxy vs fastcgi vs scgi vs wsgi” tests

Against what application framework did you run the tests?

Did you publish the results anywhere?
By what measure did proxy win?

No, I didn’t publish the results (I know, shame on me) and the only
thing
left now is text file with some results (ironically, results for
nginx+mod_scgi are missing).

Anyway, it looks like the test was “search for the best way to run WSGI
applications”.

The application in question was simple “Hello World!” backed by Google’s
webapp framework.

I tested Apache, Cherokee, lighttpd and nginx. Each server was tested
(when
possible) with FastCGI-to-WSGI, SCGI-to-WSGI and WSGI. Proxy was tested
using CherryPy and Paste.

Some random thoughts:

  1. I didn’t like Cherokee and lighttpd,
  2. SCGI seems to be ~20% faster than FastCGI (but this is probably
    because
    of small response size in test app),
  3. CherryPy behind nginx beats every other web server (req/s) and only
    losses to standalone CherryPy (and I’m not comfortable enough to run it
    without “real” web server in front of it). At least it did at the time,
    now
    it probably looses also to Tornado behind nginx :wink:

Proxy has also two very strong advantages over any Gateway Interface:

  1. it’s language & framework agnostic, and even if your framework can’t
    talk
    HTTP you can always run Python apps using CherryPy’s web server, Ruby
    apps
    using Thin and PHP apps behind Apache (because it’s the only environment
    those broken apps works in),
  2. there are no issues with pushing traffic over TCP/IP to other
    machines
    (think: clusters / web farms).

Also, this test was the reason why I started using nginx :wink:

Best regards,
Piotr S. < [email protected] >

./configure --enable-fastcgi --enable-force-cgi-redirect

How can I compile PHP? Which flag I need to remove? Did I remove
–enable-fastcgi --enable-force-cgi-redirect flag? or What flag I need
to add?

filebackup,
kind regard.

Posted at Nginx Forum:

Not exactly social coding website, but here it is anyway:
http://labs.frickle.com/misc/mod_scgi-b466baa5fcdb.patch

Best regards,
Piotr S. < [email protected] >

Hi Piotr,
Could you put your patch to some social coding websites (for ex: github,
…) so that it can be public and people outside this mailing can see
and download it ?

Huy Phan ha scritto:

Hi all,
As far as I know, there’s a SCGI module for Nginx but currently it’s not
compatible with the latest stable version (0.7.64).

My bad, but there is a reason.

  1. recently I have not worked with Nginx
  2. I have never used SCGI module in production, it was only an exercise.

Recently, an Italian hosting company has implemented an Nginx module for
their custom protocol. It is just SCGI, but using binary encoding.

It is available here:
http://projects.unbit.it/uwsgi/browser/nginx

It should not be hard to add support to both binary and ASCII (standard
SCGI) in the same module, it may be added in future.

The protocol is described here:
http://projects.unbit.it/uwsgi/#Whatabouttheprotocol

If I remember correctly, the module supports the 0.7.x branch.
I don’t know if it works with the 0.8.x branch.

[…]

Regards Manlio