Skip to content
This repository
Newer
Older
100644 132 lines (101 sloc) 4.812 kb
3c76ca41 » taher
2008-08-14 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1816 5dc97367-9…
1 == link:index.html[Index] -> link:modules.html[Modules] -> link:modules_handlers.html[Handlers]
2
280e7d00 » taher
2008-07-14 Changed documentation to asciidoc
3 Handler: CGI
4 ------------
5
6 The cgi handler executes CGI programs.
7
695401d8 » taher
2008-11-25 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2466 5dc97367-9…
8 [[parameters]]
280e7d00 » taher
2008-07-14 Changed documentation to asciidoc
9 Parameters
10 ~~~~~~~~~~
11
12 This module accepts three parameters:
13
7d3d6a27 » skarcha
2009-08-15 asciidoc.py upgraded to version 8.4.5
14 [cols="30%,15%,55%",options="header"]
15 |====================================================================
16 |Parameters |Type |Description
17 |Script Alias |String |It defines a kind of execution
18 interpreter. The CGI will be run as a
19 parameter of this script.
20 |Change to UID |String |Executes each CGI under its owner's
21 user ID.
22 |Error handler |Boolean |Use CGI output as error message.
23 |Check file |Boolean |Check file existence to build
060c80fe » taher
2010-06-28 Modifies note regarding Check file
24 PATH_INFO and SCRIPT_NAME.
7d3d6a27 » skarcha
2009-08-15 asciidoc.py upgraded to version 8.4.5
25 |Pass request |Boolean |Pass request headers.
26 |Allow X-Sendfile |Boolean |Use the non-standard X-Sendfile
27 header.
28 |Pass Request Headers |Boolean |Forward all the headers to the CGI as
29 HTTP_*
30 |====================================================================
280e7d00 » taher
2008-07-14 Changed documentation to asciidoc
31
8205a032 » taher
2008-08-12 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1786 5dc97367-9…
32 Note that the link:other_goodies.html#x-sendfile[X-Sendfile] feature
33 also supports `X-Accel-Redirect` headers transparently. This is to
34 allow the migration of applications supporting it whithout having to
35 make major code rewrites.
36
8908e2e4 » taher
2010-06-28 More doc updates
37 [[check_file_warning]]
8205a032 » taher
2008-08-12 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1786 5dc97367-9…
38 Warning:
39 ~~~~~~~~
40
060c80fe » taher
2010-06-28 Modifies note regarding Check file
41 The `Check file` flag affects how PATH_INFO and SCRIPT_NAME are
42 generated. You should disable this when you have an application that
43 is running the whole virtual server tree, as it is a common source of
44 problems. You can look at a practical example about PATH_INFO in the
f80eedb3 » taher
2009-03-10 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2955 5dc97367-9…
45 link:modules_handlers_common.html[List & Send] handler documentation.
8205a032 » taher
2008-08-12 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1786 5dc97367-9…
46
8908e2e4 » taher
2010-06-28 More doc updates
47 `Check file` must be disabled for cases such as Rails, Django, etc,
48 where everything that arrives to Cherokee must be re-sent to the
49 framework as request.
50
51 Enabling `Check file` is the way to go if you are using any kind of
52 file-based system, such as PHP.
53
060c80fe » taher
2010-06-28 Modifies note regarding Check file
54 If you are unsure of the way this is being taken into account, try
55 both settings and see how your application behaves.
8908e2e4 » taher
2010-06-28 More doc updates
56
57
695401d8 » taher
2008-11-25 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2466 5dc97367-9…
58 [[examples]]
280e7d00 » taher
2008-07-14 Changed documentation to asciidoc
59 Examples
60 ~~~~~~~~
61
ac019e41 » taher
2008-08-08 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1773 5dc97367-9…
62 This is a pretty common example. It defines a directory called `cgi`
66bc367b » taher
2008-09-15 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1992 5dc97367-9…
63 that points to a path out of the Sever root directory where the
ac019e41 » taher
2008-08-08 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1773 5dc97367-9…
64 CGI programs are located.
280e7d00 » taher
2008-07-14 Changed documentation to asciidoc
65
f7368c53 » taher
2011-03-21 Cleanup screenshots and add tables for readability
66 .Handler CGI configuration
67 [cols="50%,50%"]
68 |====================================================================
69 |Handler | CGI
70 |Document Root | /usr/lib/cgi-bin
71 |Script Alias | None
72 |Change UID | Disabled
73 |Error handler | Disabled
74 |Check file | Enabled
75 |Pass Request Headers | Enabled
76 |Allow X-Sendfile | Disabled
77 |====================================================================
78
79 .Handler CGI intreface
ac019e41 » taher
2008-08-08 git-svn-id: svn://cherokee-project.com/cherokee/trunk@1773 5dc97367-9…
80 image::media/images/admin_handler_cgi.png[CGI]
dd3d8100 » taher
2008-11-03 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2305 5dc97367-9…
81
85a8a691 » taher
2009-01-21 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2738 5dc97367-9…
82 .Script Alias
83 Another example could be the case where you wanted your default
84 requests to be managed by a specific script.
85
86 A real life example could be running
87 link:http://trac.edgewall.org[Trac] as a CGI script. In that case you
f80eedb3 » taher
2009-03-10 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2955 5dc97367-9…
88 would want to map an URL to the trac.cgi script.
85a8a691 » taher
2009-01-21 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2738 5dc97367-9…
89
90 For this you only need to set up the Script Alias option. Assuming you
91 are using a `Directory`-type rule for the path `/trac` managed by the
92 `CGI` handler, you could set `/usr/share/trac/cgi-bin/trac.cgi` as
93 Script Alias.
94
95 After this, every request that matched the `/trac` path would be
96 managed by the `trac.cgi` script.
97
dd3d8100 » taher
2008-11-03 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2305 5dc97367-9…
98 //////
99 Environment variables
100 ~~~~~~~~~~~~~~~~~~~~~
101
102 When working with CGI and redirections, sometimes it is convenient to
103 have some persistent information between the CGI invocations. This is
104 the case when an error has to be redirected to a error-handling page.
105
106 To ease up accessing such values, some server environment variables are
107 set by Cherokee. The complete list of environment variables added
108 follows:
109
110 This info will be added upon completion of issue 40
111
112 * REDIRECT_URL: the URL-path that was not found. For example, if a
113 missing page -`http://example.net/nonexistent.htm`- was requested,
114 this variable would be set to `/nonexistent.html`.
115
116 * REDIRECT_STATUS: the HTTP response obtained from the original
117 request. This is `404`.
118
119 * REDIRECT_REQUEST_METHOD: the method of the original request, such as
120 GET or POST.
121
122 * REDIRECT_ERROR_NOTES: a brief description of what went wrong, for
123 example, "File does not exist: /usr/local/docroot/nonexistent.html".
124
125 * SERVER_ADDR: This will typically be `::1` which is a unicast
3c112e23 » skinkie
2010-03-19 aspelled modules
126 localhost address. This means that the packets sent to this address
dd3d8100 » taher
2008-11-03 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2305 5dc97367-9…
127 will be looped back on the same virtual interface.
128
3c112e23 » skinkie
2010-03-19 aspelled modules
129 * SERVER_PORT: Port to which the request was performed originally.
dd3d8100 » taher
2008-11-03 git-svn-id: svn://cherokee-project.com/cherokee/trunk@2305 5dc97367-9…
130
131 * REMOTE_PORT: Port to which the request was served.
132 //////
Something went wrong with that request. Please try again.