Cgi bin directory for each user in Apache

This page describes how to give each user his own cg-bin directory.

The following lines should be added to the Apache configuration file http.conf :

<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-script

Along with this there are some more points to be kept in mind. If you .htaccess file has a section like this :

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteCond %{http_host} ^ [nc]
	RewriteRule ^(.*)$$1 [r=301,nc]

then putting the cgi configuration will give this error :
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden
and the cgi files won't work. The solution is : Options +ExecCGI instead of Options ExecCGI

Also make sure that this line :
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
is commented, otherwise all request to would go to /var/www/cgi-bin instead of the user's cgi-bin directory.

If you get Internal Server Errors then try the solutions given on this page

Last Updated On : 3rd June 2013

Subscribe to get updates delivered to your inbox

Leave a comment