Problem with cgi-bin directory

I want to execute cgi files from /var/www/html/cgi-bin and /var/www/html/s1/cgi-bin. I currently have this in my httpd.conf

Options Indexes FollowSymLinks ExecCGI
ScriptAlias /cgi-bin/ "/var/www/html/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

Cgi files in /var/www/html/cgi-bin work perfectly but when I try to execute /var/www/html/s1/cgi-bin/test.cgi, I get errors saying I can't execute a directory /var/www/cgi-bin and that /var/www/cgi-bin/test.cgi does not exist.

How can I fix this problem?


Make sure the ScriptAlias place is in the "mod_alias" directives. (tags).

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
</IfModule>

Edit: Of course use linux folder systems and not "C:/" etc.


Got it working by adding to httpd.conf

<Directory "/var/www/html/s1/cgi-bin">
    Options +ExecCGI -Indexes
    AddHandler cgi-script cgi pl
</Directory>