1Plack::Handler::FCGI(3)User Contributed Perl DocumentatioPnlack::Handler::FCGI(3)
2
3
4
6 Plack::Handler::FCGI - FastCGI handler for Plack
7
9 # Run as a standalone daemon
10 plackup -s FCGI --listen /tmp/fcgi.sock --daemonize --nproc 10
11
12 # Run from your web server like mod_fastcgi
13 #!/usr/bin/env plackup -s FCGI
14 my $app = sub { ... };
15
16 # Roll your own
17 my $server = Plack::Handler::FCGI->new(
18 nproc => $num_proc,
19 listen => [ $port_or_socket ],
20 detach => 1,
21 );
22 $server->run($app);
23
25 This is a handler module to run any PSGI application as a standalone
26 FastCGI daemon or a .fcgi script.
27
28 OPTIONS
29 listen
30 listen => [ '/path/to/socket' ]
31 listen => [ ':8080' ]
32
33 Listen on a socket path, hostname:port, or :port.
34
35 port
36 listen via TCP on port on all interfaces (Same as "listen =>
37 ":$port"")
38
39 leave-umask
40 Set to 1 to disable setting umask to 0 for socket open
41
42 nointr
43 Do not allow the listener to be interrupted by Ctrl+C
44
45 nproc
46 Specify a number of processes for FCGI::ProcManager
47
48 pid Specify a filename for the pid file
49
50 manager
51 Specify a FCGI::ProcManager sub-class
52
53 daemonize
54 Daemonize the process.
55
56 keep-stderr
57 Send STDERR to STDOUT instead of the webserver
58
59 WEB SERVER CONFIGURATIONS
60 nginx
61
62 This is an example nginx configuration to run your FCGI daemon on a
63 Unix domain socket and run it at the server's root URL (/).
64
65 http {
66 server {
67 listen 3001;
68 location / {
69 set $script "";
70 set $path_info $uri;
71 fastcgi_pass unix:/tmp/fastcgi.sock;
72 fastcgi_param SCRIPT_NAME $script;
73 fastcgi_param PATH_INFO $path_info;
74 fastcgi_param QUERY_STRING $query_string;
75 fastcgi_param REQUEST_METHOD $request_method;
76 fastcgi_param CONTENT_TYPE $content_type;
77 fastcgi_param CONTENT_LENGTH $content_length;
78 fastcgi_param REQUEST_URI $request_uri;
79 fastcgi_param SEREVR_PROTOCOL $server_protocol;
80 fastcgi_param REMOTE_ADDR $remote_addr;
81 fastcgi_param REMOTE_PORT $remote_port;
82 fastcgi_param SERVER_ADDR $server_addr;
83 fastcgi_param SERVER_PORT $server_port;
84 fastcgi_param SERVER_NAME $server_name;
85 }
86 }
87 }
88
89 If you want to host your application in a non-root path, then you
90 should mangle this configuration to set the path to "SCRIPT_NAME" and
91 the rest of the path in "PATH_INFO".
92
93 See <http://wiki.nginx.org/NginxFcgiExample> for more details.
94
95 Apache mod_fastcgi
96
97 You can use "FastCgiExternalServer" as normal.
98
99 FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/fcgi.sock
100
101 See
102 <http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer>
103 for more details.
104
105 lighttpd
106
107 To host the app in the root path, you're recommended to use lighttpd
108 1.4.23 or newer with "fix-root-scriptname" flag like below.
109
110 fastcgi.server = ( "/" =>
111 ((
112 "socket" => "/tmp/fcgi.sock",
113 "check-local" => "disable"
114 "fix-root-scriptname" => "enable",
115 ))
116
117 If you use lighttpd older than 1.4.22 where you don't have
118 "fix-root-scriptname", mouting apps under the root causes wrong
119 "SCRIPT_NAME" and "PATH_INFO" set. Also, mouting under the empty root
120 ("") or a path that has a trailing slash would still cause weird values
121 set even with "fix-root-scriptname". In such cases you can use
122 Plack::Middleware::LighttpdScriptNameFix to fix it.
123
124 To mount in the non-root path over TCP:
125
126 fastcgi.server = ( "/foo" =>
127 ((
128 "host" = "127.0.0.1"
129 "port" = "5000"
130 "check-local" => "disable"
131 ))
132
133 It's recommended that your mount path does NOT have the trailing slash.
134 If you really need to have one, you should consider using
135 Plack::Middleware::LighttpdScriptNameFix to fix the wrong PATH_INFO
136 values set by lighttpd.
137
139 Plack
140
141
142
143perl v5.12.3 2011-06-22 Plack::Handler::FCGI(3)