
136
|
Chapter 6: Administering Apache
will display something like:
Tuesday, 01-Aug-2006 02:42:24 GMT
If you have only static files, or a mixture of static files and CGI scripts, it’s safest to
disable SSI command execution:
<Location />
Options IncludesNoExec
</Location>
CGI
CGI is a much more flexible (and dangerous) way of running programs on web serv-
ers, since users can pass information to the programs. Apache has two ways of speci-
fying what programs can be run as CGI programs.
Location
Either of the following directives will associate CGI programs in the /var/cgi direc-
tory with URLs beginning with http://server1.centralsoft.org/cgi/:
ScriptAlias /cgi /var/cgi
or:
<Location /cgi>
Options ExecCGI
</Location>
File suffix
The suffix method associates a MIME type (a file-type naming standard) with a suffix.
The PHP module uses this method to get Apache to pass .php files to the mod_php
interpreter:
AddType application/x-httpd-php .php
Here are the full contents of the Apache configuration file for mod_php (/etc/apache2/
mods-enabled/php4.conf), which also treats files with the .phtml or .php3 suffix as
PHP:
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
The first AddType line causes any files ending with .php, .php3,or.phtml to be exe-
cuted as PHP CGI programs. The second
AddType line causes Apache to pretty-print
the contents ...