Cgi bin directory for each user in Apache

By | May 9, 2020

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 ^(.*)$\ [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

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *