The Common Gateway Interface (CGI) is a standard for interfacing external applications with information servers, such as the Apache Web Server. An HTML document is static, which means it exists in a constant state. It is a text file that doesn't change. A CGI program, on the other hand, is executed in real-time so that it can provide dynamic output.
Installation
Your Virtual Private Server features full CGI support.
- Installing and Debugging Your Own CGIs (how to upload scripts)
- CGI Security Issues
Configuration
CGI programs that are installed in the ~/www/cgi-bin directory will automatically be executed by the Web server when accessed from a Web browser. If you install CGI programs in the ~/www/htdocs directory, they will not be automatically executed by the Web server. To configure the Web server, connect to your Virtual Private Server via Telnet or SSH and do the following (if your server hosts multiple domains, see also configuration for virtual subhosts below).
-
Uncomment this AddHandler directive in the Web server configuration file (~/www/conf/httpd.conf):
AddHandler cgi-script .cgi
You may want to add a Handler for Perl scripts:
AddHandler cgi-script .pl
-
Add an ExecCGI option to the Options for your Root Document declaration (<Directory /usr/local/etc/httpd/htdocs>) also in the Web server configuration file (~/www/conf/httpd.conf):
Options Indexes FollowSymLinks ExecCGI
Configuration for Virtual Subhosts
If you have set up a ScriptAlias for your server, subhost.com/cgi-bin/ will refer to the server's main cgi-bin directory automatically. You may also choose to set up a cgi-local directory for each subhosted domain using the Virtual Hosts tool in iManager, to allow each subhosted domain to upload their own CGI scripts (CGI Security Issues).
-
Edit the virtual host and add the following:
<Directory /usr/local/etc/vhosts/subhostdirectory/cgi-local>
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
Options FollowSymLinks ExecCGI
</Directory>
-
Create the folder /usr/local/etc/vhosts/subhostdirectory/cgi-local
-
Upload scripts into this folder. Remember to set each file's permissions to "-rwxr-xr-x" (executable by all) using your FTP program, or you will have errors accessing your scripts.
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771