- Lighttpd
- Andre Bogus
- 123字
- 2021-08-25 18:06:22
CGI with mod_cgi
To enable CGI in Lighttpd, we need to include and configure the module. For example, we might want to execute all files with the cgi
extension:
server.modules += ("mod_cgi") cgi.assign = (".cgi" => "")
The "" in cgi.assign
means that CGI scripts are started in their own shell. Otherwise, this entry would contain the path to the CGI interpreter/application.
We probably want to add index.cgi
to the list of index files:
server.indexfiles = ("index.cgi", "index.html")
Alternatively, we might prefer putting all CGI programs in one directory instead of distinguishing them by extension:
cgi.assign = ("/cgi-bin/" => "") # Patterns starting with "/" match the path.
If the CGI protocol is very simple, why should the configuration be any more complex?