Apache-cgi

From SlackWiki
Jump to: navigation, search


To enable a cgi directory for each user

In order to give each user their own cgi-bin directory, edit the:

Apache1 (Slackware pre-12.0): /etc/httpd/httpd.conf file
Apache2 (Slackware 12.0+): /etc/httpd/extra/httpd-users.conf file
...and add:
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI
SetHandler cgi-script
</Directory>

Then, presuming that UserDir is set to public_html, a cgi program example.cgi could be loaded from that directory as:

http://example.com/~rbowen/cgi-bin/example.cgi


To enable a cgi directory for each virtual host

In the Virtual Host section of your apache config file (/etc/apache/httpd.conf) add the ScriptAlias line below.

<VirtualHost *:80>
ServerName www.MyDomain.org
DocumentRoot /home/MyDomain/public_html
ErrorLog /var/log/MyDomain/error.log
ScriptAlias /cgi-bin/ "/home/MyDomain/public_html/cgi-bin/"
</VirtualHost>