4

I need to serve some FCGI scripts (via WSAPI, but that is irrelevant) from nginx.

Currently I'm using spawn_fcgi to do this. This is the only solution I've found.

I need to know my other options. Are there any other ways to run FastCGI under nginx?

4 Answers4

5

I personally prefer to decouple my FCGI processes from the webserver as much as possible, and manage them as I would any other daemon. In my case, I've switched all of that sort of thing to use daemontools, because it's small, lightweight, is very reliable, and does exactly what you need in this instance, with no mess or fuss.

womble
  • 98,245
2

Yet again nobody mentioned php-fpm. It's now bundled with php itself so you should read docs about php-fpm in PHP manual.

SaveTheRbtz
  • 5,761
0

Potentially there's cgi-fcgi. What don't you like about the current method you're using?

user6373
  • 174
-1

Theoretically, there are 3 options how PHP can be attached to nginx:

  1. Module. Currently, there's no nginx PHP module. Minus.
  2. CGI. PHP is spawned at every request, and a single php process parses a single php file. execve() overhead is obvious. Dirty Plus.
  3. FCGI. Pre-spawned processes which handle requests, and never stop. Plus.

There's 2 methods of creating these FCGI processes:

  1. Pre-launch them. That's what spawn_fcgi does, and that is okay.
  2. Let nginx launch them: nginx tries to connect to localhost:, and if there's nobody listening, spawns php FCGI workers. That would have been better in terms of administration comfort and stability, but I've never heard of such a module for nginx :) Maybe, you'll be the first one to develop it? ;)

spawn script is not evil, really :)

P.S. Походу, самый пытливый ум у русских ;)

kolypto
  • 11,588