Marking Resources As Executable CGIs


ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin


This section shows a number of ways to tell Apache that the target file for a particular request is a CGI script. This is necessary so Apache will not serve the contents of the file directly to the client, but rather return the results of executing it.

The ScriptAlias directive is similar to the Alias directive described earlier in this chapter, but with the difference that Apache will treat every file in the target directory as a CGI script. Alternatively, you can use any <Files>, <Location>, and <Directory> sections in combination with the SetHandler directive to tell Apache that the contents of these sections are CGI programs. In this case, you will also need to provide an Options +ExecCGI directive to tell Apache that CGI execution is allowed. The following example tells Apache to treat all URLs ending with a .pl file extension as CGI scripts.

<Location "/cgi-bin/*.pl"> Options +ExecCGI SetHandler cgi-script </Location>





Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net