1

I am trying to test perl scripts through localhost. I configured apache to allow perl scripts to be run from /usr/lib/cgi-bin (or so I thought). Whenever I go to localhost/cgi-bin/script.pl I get a 403 Forbidden error. Here is my apache conf file.

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /home/cgtopher/public_html/

<Directory /home/cgtopher/public_html/>
Options FollowSymLinks Indexes
AllowOverride None
Order allow,deny
allow from all
</Directory>

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

#cgi-bin

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory "/usr/lib/cgi-bin">

AllowOverride None

Options ExecCGI FollowSymLinks

Order allow,deny

Require all granted

</Directory>

ErrorLog /home/cgtopher/.apache/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

In my error log I keep getting this:

[Sat Sep 05 10:30:12.565510 2015] [access_compat:error] [pid 10918] [client 127.0.0.1:60699] AH01797: client denied by server configuration: /usr/lib/cgi-bin/hello.pl
cgtopher
  • 13
  • 4

1 Answers1

2

You have Order allow,deny, which will reject the request unless at least one Allow directive passes.

You have no Allow directive (except for Directory /home/cgtopher/public_html/, which does not cover the cgi-bin directory).

(Add Allow from all to the cgi-bin directory?)

The Sidhekin
  • 283
  • 1
  • 2
  • 7
  • Thanks for that! Looks like it worked, with one caveat. Instead of the script running (just a hello world for testing) I'm getting prompted to download it. So we're halfway there! – cgtopher Sep 06 '15 at 00:24
  • That's odd. ScriptAlias should set the handler. Are you sure it's the script that's being downloaded, and not its output? – The Sidhekin Sep 06 '15 at 22:05