Apache 2.4 Ubuntu access denied for cgi-bin

I have the following apache configuration:

DocumentRoot "/var/www/html"
ScriptAlias /cgi-bin/ /var/www/cgi-bin
<Directory "/var/www/cgi-bin">
      AllowOverride None
      AddHandler cgi-script .cgi .pl 
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow from all
      Require all granted
</Directory>

Inside /var/www/cgi-bin I have the file:

-rwxr-xr-x 1 root root  288 Jan 23 14:29 test.pl*

The file has valid perl script that is being launched when I execute it directly. But when I try to run it as cgi:

$wget http://localhost:8080/cgi-bin/test.pl

I get ERROR 403: Forbidden. The following line is added to the error log:

[Sat Jan 23 15:42:44.655000 2016] [authz_core:error]
[pid 1751:tid 140567392528128] [client 127.0.0.1:34927] 
AH01630: client denied by server configuration: /var/www/cgi-bintest.pl

For some reason there is no slash cgi-bintest.pl. What could be the issue?

Answer

It was the missing slash at the end:

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

Attribution
Source : Link , Question Author : user4035 , Answer Author : user4035

Leave a Comment