I’m new to Sysadmin and Apache configuration. Trying to get AWStats running, but in troubleshooting have gotten to trying to run a simple Hello World (html output) script on port 8888 and have been hitting a wall of 403 Forbidden.

It’s not the script:

mikekilmer@glitchbox:/var/www/html$ perl /usr/lib/cgi-bin/hello.pl
Content-type: text/html


<TITLE>Hello, world!</TITLE>

<H1>Hello, world!</H1>


Shebang matches path to perl: #!/usr/bin/perl

These are the main config settings:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied

<Directory /usr/share>
        AllowOverride None
        Require all granted

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

Directory and file permissions are 755 and 644 with ownership being root:root (on the cgi-bin and perl files).

Apache’s html/index.html shows up: http://www.infiniteglitch.net:8888/manual.html/howto/cgi.html

This is what the error log says: [Sat Jun 06 05:53:24.412867 2015] [authz_core:error] [pid 28374:tid 140381836453632] [client] AH01630: client denied by server configuration: /usr/local/apache2

I think maybe I’m missing something with Configuring Apache to permit CGI.

Module 1. Note: If Apache has been built with shared module support you need to ensure that the module is loaded; in your apache2.conf you need to make sure the LoadModule directive has not been commented out. A correctly configured directive may look like this:

LoadModule cgi_module modules/mod_cgi.so

I don’t know if it was built with shared module support. Installed with apt-get. Not finding the line LoadModule in the config file. If I add the above line above line to apache2.conf, Apache won’t restart.

ScriptAlias 2. There is one ScriptAlias in the config file, put there by AWStats. Adding this directive ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/ didn’t seem to do anything. I even tried moving my hello (or should i say hellp) script into /usr/local/apache2/cgi-bin/ still 403.

Explicitly using Options Even tried adding

Options +ExecCGI
AddHandler cgi-script .cgi

to the <Directory /var/www/> directive.

All to no avail. Any ideas for next step?

1 Answer 1

[Sat Jun 06 05:53:24.412867 2015] [authz_core:error] [pid 28374:tid 140381836453632] [client] AH01630: client denied by server configuration: /usr/local/apache2

That means you haven't configured authorization for your webserver.

What you want to do is ensure that you have something like

<Directory /usr/local/apache2/cgi-bin>
    Require all granted

Note that in Debian, there's an advanced configuration system which would have done all of this for you, if you would have used it ;-)

To do so, first remove (or comment out) the things you've already added. Then:

a2enmod cgi
service apache2 restart
  • Finally. Thank you. In the Apache docs (/usr/share/doc/apache2/README.Debian) it recommends against "touching" etc/apache2/apache2.conf, but that is the file that AWStats edits upon configuration. Would you recommend moving those changes to a conf-available file?
    – MikeiLL
    Jun 8, 2015 at 15:27
  • 1
    Yes, I would use a conf-available file. The downside of editing apache2.conf directly is that you don't easily get any future updates to that file. Having said that though, if you do edit it, note that Debian won't override your changes, so if you feel like you need to do so, you can! Jun 9, 2015 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.