Novell LINUX ENTERPRISE SERVER 10 SP2 - INSTALLATION AND ADMINISTRATION Installation Manual page 790

Hide thumbs Also See for LINUX ENTERPRISE SERVER 10 SP2 - INSTALLATION AND ADMINISTRATION:
Table of Contents

Advertisement

Example 40.5 VirtualHost CGI Configuration
ScriptAlias /cgi-bin/ "/srv/www/www.example.com/cgi-bin/"
<Directory "/srv/www/www.example.com/cgi-bin/">
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Order allow,deny
Allow from all
</Directory>
Tells Apache to handle all files within this directory as CGI scripts.
Enables CGI script execution
Tells the server to treat files with the extensions .pl and .cgi as CGI scripts. Adjust
according to your needs.
The Order and Allow directives control the default access state and the order
in which Allow and Deny directives are evaluated. In this case "deny" statements
are evaluated before "allow" statements and access from everywhere is enabled.
40.5.2 Running an Example Script
CGI programming differs from "regular" programming in that the CGI programs and
scripts must be preceded by a MIME-Type header such as Content-type:
text/html. This header is sent to the client, so it understands what kind of content
it receives. Secondly, the script's output must be something the client, usually a Web
browser, understands—HTML in most cases or plain text or images, for example.
A simple test script available under /usr/share/doc/packages/apache2/
test-cgi is part of the Apache package. It outputs the content of some environment
variables as plain text. Copy this script to either /srv/www/cgi-bin/ or the script
directory of your virtual host (/srv/www/www.example.com/cgi-bin/) and
name it test.cgi.
Files accessible by the Web server should be owned by to the user root (see Sec-
tion 40.7, "Avoiding Security Problems" (page 779) for additional information). Because
the Web server runs with a different user, the CGI scripts must be world-executable
and world-readable. Change into the CGI directory and use the command chmod 755
test.cgi to apply the proper permissions.
772
Installation and Administration

Advertisement

Table of Contents
loading

This manual is also suitable for:

Suse linux enterprise server 10 sp3

Table of Contents