1Catalyst::Manual::DeploUysmeerntC:o:nntgrCiianbtxua:tl:eyFdsatsP:te:CrMGlaIn(Du3oa)clu:m:eDnetpaltoiyomnent::nginx::FastCGI(3)
2
3
4
6 Catalyst::Manual::Deployment::nginx::FastCGI - Deploying Catalyst with
7 nginx
8
10 Catalyst runs under nginx via FastCGI in a similar fashion as the
11 lighttpd standalone server.
12
13 nginx does not have its own internal FastCGI process manager, so you
14 must run the FastCGI service separately.
15
16 Configuration
17 To configure nginx, you must configure the FastCGI parameters and also
18 the socket your FastCGI daemon is listening on. It can be either a TCP
19 socket or a Unix file socket.
20
21 The server configuration block should look roughly like:
22
23 server {
24 listen $port;
25
26 location / {
27 fastcgi_param QUERY_STRING $query_string;
28 fastcgi_param REQUEST_METHOD $request_method;
29 fastcgi_param CONTENT_TYPE $content_type;
30 fastcgi_param CONTENT_LENGTH $content_length;
31
32 fastcgi_param SCRIPT_NAME '';
33 fastcgi_param PATH_INFO $fastcgi_script_name;
34 fastcgi_param REQUEST_URI $request_uri;
35 fastcgi_param DOCUMENT_URI $document_uri;
36 fastcgi_param DOCUMENT_ROOT $document_root;
37 fastcgi_param SERVER_PROTOCOL $server_protocol;
38
39 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
40 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
41
42 fastcgi_param REMOTE_ADDR $remote_addr;
43 fastcgi_param REMOTE_PORT $remote_port;
44 fastcgi_param SERVER_ADDR $server_addr;
45 fastcgi_param SERVER_PORT $server_port;
46 fastcgi_param SERVER_NAME $server_name;
47
48 # Adjust the socket for your applications!
49 fastcgi_pass unix:$docroot/myapp.socket;
50 }
51 }
52
53 It is the standard convention of nginx to include the fastcgi_params in
54 a separate file (usually something like "/etc/nginx/fastcgi_params")
55 and simply include that file.
56
57 If you include the "/etc/nginx/fastcgi_params" that comes with your
58 distribution, e.g. Debian, you need to adjust a couple of parameters
59 for PSGI compatibility, use something like this:
60
61 include /etc/nginx/fastcgi_params;
62 fastcgi_param SCRIPT_NAME '';
63 fastcgi_param PATH_INFO $fastcgi_script_name;
64
65 Non-root configuration
66 If you properly specify the PATH_INFO and SCRIPT_NAME parameters your
67 application will be accessible at any path. The SCRIPT_NAME variable is
68 the prefix of your application, and PATH_INFO would be everything in
69 addition.
70
71 As an example, if your application is rooted at /myapp, you would
72 configure:
73
74 rewrite ^/myapp$ /myapp/ permanent;
75 location /myapp/ {
76 include /etc/nginx/fastcgi_params;
77 fastcgi_param SCRIPT_NAME /myapp/;
78 fastcgi_param PATH_INFO $fastcgi_script_name;
79 fastcgi_pass unix:/tmp/myapp.socket;
80 }
81
82 $fastcgi_script_name would be "/myapp/path/of/the/action". Catalyst
83 will process this accordingly and setup the application base as
84 expected.
85
86 This behavior is somewhat different from Apache and lighttpd, but is
87 still functional.
88
89 Note that the rewrite may not be needed with newer versions of nginx,
90 and the paths must be exactly as specified - the trailing slash in the
91 location block and the SCRIPT_NAME are important.
92
93 SSL
94 Make sure that nginx passes this to your fastcgi. To ensure this, you
95 need the following in your nginx config for the SSL vhost:
96
97 fastcgi_param HTTPS on
98
100 For more information on nginx, visit: <https://nginx.net>
101
103 Catalyst Contributors, see Catalyst.pm
104
106 This library is free software. You can redistribute it and/or modify it
107 under the same terms as Perl itself.
108
109
110
111perl v5.36.0 Cat2a0l2y3s-t0:1:-M2a0nual::Deployment::nginx::FastCGI(3)