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
0

1 Answer 1

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?)

Sign up to request clarification or add additional context in comments.

2 Comments

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!
That's odd. ScriptAlias should set the handler. Are you sure it's the script that's being downloaded, and not its output?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.