spawn-fcgi 学习笔记

spawn-fcgi 用法了解

spawn-fcgi 是一个小程序,作用是管理 fast-cgi 进程。

用 spawn 启动 FCGI 程序的方式为:

1
./spawn-fcgi -a 127.0.0.1 -p 8080 -F ${count} -f ${webroot}/bin/demo.fcgi

这样就会启动 count 个 demo.fcgi 程序,他们共同监听同一个 listen 端口 8080,从而提供服务。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
./spawn_fcgi -h
Usage: spawn-fcgi [options] [-- <fcgiapp> [fcgi app arguments]]

spawn-fcgi v1.6.5 - spawns FastCGI processes

Options:
-f <path> filename of the fcgi-application (deprecated; ignored if
<fcgiapp> is given; needs /bin/sh)
-d <directory> chdir to directory before spawning
-a <address> bind to IPv4/IPv6 address (defaults to 0.0.0.0)
-p <port> bind to TCP-port
-s <path> bind to Unix domain socket
-M <mode> change Unix domain socket mode (octal integer, default: allow
read+write for user and group as far as umask allows it)
-C <children> (PHP only) numbers of childs to spawn (default: not setting
the PHP_FCGI_CHILDREN environment variable - PHP defaults to 0)
-F <children> number of children to fork (default 1)
-b <backlog> backlog to allow on the socket (default 1024)
-P <path> name of PID-file for spawned process (ignored in no-fork mode)
-n no fork (for daemontools)
-v show version
-?, -h show this help
(root only)
-c <directory> chroot to directory
-S create socket before chroot() (default is to create the socket
in the chroot)
-u <user> change to user-id
-g <group> change to group-id (default: primary group of user if -u
is given)
-U <user> change Unix domain socket owner to user-id
-G <group> change Unix domain socket group to group-id