Cgi bin directory for each user in Apache

This page http://httpd.apache.org/docs/2.2/howto/cgi.html 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
</Directory>

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} ^site.com [nc]
	RewriteRule ^(.*)$ http://www.site.com/$1 [r=301,nc]
</IfModule>

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 www.site.com/cgi-bin 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
http://encodable.com/internal_server_error/







Last Updated On : 3rd June 2013

Subscribe to get updates delivered to your inbox

Leave a comment