Apache-cgi: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Copy from old, had no category, placed in Tips)
 
No edit summary
Line 2: Line 2:


==To enable a cgi directory for each user==
==To enable a cgi directory for each user==
In order to give each user their own cgi-bin directory, edit the:
In order to give each user their own cgi-bin directory, edit the:



Revision as of 10:34, 9 December 2011


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>