Revert "Note that Apache 1.3 won't work with mod_perl with >= catalyst 5.9"
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Deployment / nginx / FastCGI.pod
CommitLineData
45b58a85 1=head1 NAME
2
3Catalyst::Manual::Deployment::nginx::FastCGI - Deploying Catalyst with nginx
4
0191b435 5=head1 nginx
45b58a85 6
7Catalyst runs under nginx via FastCGI in a similar fashion as the lighttpd
8standalone server as described above.
9
10nginx does not have its own internal FastCGI process manager, so you must run
11the FastCGI service separately.
12
0191b435 13=head2 Configuration
45b58a85 14
15To configure nginx, you must configure the FastCGI parameters and also the
16socket your FastCGI daemon is listening on. It can be either a TCP socket
17or a Unix file socket.
18
19The server configuration block should look roughly like:
20
21 server {
22 listen $port;
23
24 location / {
25 fastcgi_param QUERY_STRING $query_string;
26 fastcgi_param REQUEST_METHOD $request_method;
27 fastcgi_param CONTENT_TYPE $content_type;
28 fastcgi_param CONTENT_LENGTH $content_length;
29
30 fastcgi_param SCRIPT_NAME /;
31 fastcgi_param PATH_INFO $fastcgi_script_name;
32 fastcgi_param REQUEST_URI $request_uri;
33 fastcgi_param DOCUMENT_URI $document_uri;
34 fastcgi_param DOCUMENT_ROOT $document_root;
35 fastcgi_param SERVER_PROTOCOL $server_protocol;
36
37 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
38 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
39
40 fastcgi_param REMOTE_ADDR $remote_addr;
41 fastcgi_param REMOTE_PORT $remote_port;
42 fastcgi_param SERVER_ADDR $server_addr;
43 fastcgi_param SERVER_PORT $server_port;
44 fastcgi_param SERVER_NAME $server_name;
45
46 # Adjust the socket for your applications!
47 fastcgi_pass unix:$docroot/myapp.socket;
48 }
49 }
50
51It is the standard convention of nginx to include the fastcgi_params in a
52separate file (usually something like C</etc/nginx/fastcgi_params>) and
53simply include that file.
54
0191b435 55=head2 Non-root configuration
45b58a85 56
57If you properly specify the PATH_INFO and SCRIPT_NAME parameters your
58application will be accessible at any path. The SCRIPT_NAME variable is the
59prefix of your application, and PATH_INFO would be everything in addition.
60
61As an example, if your application is rooted at /myapp, you would configure:
62
63 fastcgi_param SCRIPT_NAME /myapp/;
64 fastcgi_param PATH_INFO $fastcgi_script_name;
65
66C<$fastcgi_script_name> would be "/myapp/path/of/the/action". Catalyst will
67process this accordingly and setup the application base as expected.
68
69This behavior is somewhat different than Apache and Lighttpd, but is still
70functional.
71
72For more information on nginx, visit:
73L<http://nginx.net>
74
75=head1 AUTHORS
76
77Catalyst Contributors, see Catalyst.pm
78
79=head1 COPYRIGHT
80
81This library is free software. You can redistribute it and/or modify it under
82the same terms as Perl itself.
83
84=cut