4
votes

I have been playing around with Apache CGI and am trying to run a CGI script when a specific file extension is requested.

I have the following in my apache2.conf:

AddHandler handle .html
Action handle /use/lib/cgi-bin/test.pl virtual

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin>
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

So when I try to request an html page, Hello.html, from my DocumentRoot directory I get an error message that says it could not find a path which combines the location of my CGI script and requested file:

Not Found

The requested URL /usr/lib/cgi-bin/test.pl/hello.html was not found on this server. Apache/2.2.22 (Ubuntu) Server at ryan-virtualbox Port 80Not Found

Why would my CGI script not run, and why is this combined path presented as Not Found?

Thanks in advance.

1

1 Answers

3
votes

According to mod_actions documentation, the cgi-script is the URL-path to a resource. So I guess your Action directive should be rewritten:

Action handle /cgi-bin/test.pl virtual