mod_cgi for nginx - anyone?
Jim Ohlstein
jim.ohlstein at gmail.com
Sun Feb 8 22:13:08 MSK 2009
I tried that also and while it starts multiple instances, if I run them using user "nobody" I get a 502 Bad Gateway response from Nginx.
This is how I edited the script:
#!/usr/bin/perl
use strict;
use warnings FATAL => qw( all );
use IO::Socket::UNIX;
my $bin_path = '/usr/local/bin/fcgiwrap';
my $socket_path = $ARGV[0] || '/tmp/cgi.sock';
my $num_children = $ARGV[1] || 5;
close STDIN;
unlink $socket_path;
my $socket = IO::Socket::UNIX->new(
Local => $socket_path,
Listen => 10000,
);
die "Cannot create socket at $socket_path: $!\n" unless $socket;
for (1 .. $num_children) {
my $pid = fork;
die "Cannot fork: $!" unless defined $pid;
next if $pid;
exec "sudo -u nobody $bin_path";
die "Failed to exec
Jim
> -----Original Message-----
> From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of
> Grzegorz Nosek
> Sent: Sunday, February 08, 2009 1:34 PM
> To: nginx at sysoev.ru
> Subject: Re: mod_cgi for nginx - anyone?
>
> On Sun, Feb 08, 2009 at 11:48:32AM -0500, Jim Ohlstein wrote:
> > OK, I'm sure that I'm missing something, but I'm having trouble
> getting more than one instance going.
> >
> > I tried
> >
> > # /usr/local/bin/spawn-fcgi -C 5 -a 127.0.0.1 -p 10000 -u nobody -g
> nobody -f /usr/local/bin/fcgiwrap but only saw one instance generated.
>
> -C only sets an environment variable for php-fcgi, it doesn't actually
> run multiple instances of anything.
>
> > Do you have a sample script to start it with "X" number of children
>
> See http://nginx.localdomain.pl/ for a simple Perl launcher.
>
> Best regards,
> Grzegorz Nosek
More information about the nginx
mailing list