1

I asked this on Stack Overflow a day or two ago and haven't gotten any response yet. Hoping for some insight here in getting AWStats configured and running on Debian Jessie.

Installed AWStats with apt-get install awstats. No complaints.

Installed Apache2 the same way.

Copied /usr/share/doc/awstats/examples/apache.conf to /etc/apache2/conf-available/awstats.conf.

Activated with sudo a2enconf awstats.

Restarted Apache with sudo systemctl restart apache2.service.

Using port 8888 and getting "Forbidden" response in browser at:

http://infiniteglitch.net:8888/cgi-bin/awstats.pl

Running from the command line just gives the help doc.

Permissions are 644. Owner is root.

What step or configuration is missing here, please?

MikeiLL
  • 247
  • 1
  • 4
  • 10
  • The reason "Running from command line just gives the help doc" is because you need to give a config parameter. (`--config=domain.net`) Working from CLI with a test log file that is Apache compliant. The way to call from the browser is: domain.net:8888/cgi-bin/awstats.pl?config=domain.net Still "Forbidden", though. But it’s not an AWStats issue because: domain.net:8888/cgi-bin/hello.pl (Hello World) is also coming up as forbidden. – MikeiLL Jun 04 '15 at 18:55
  • discovered the apache2 error log: [Thu Jun 04 18:46:28.633521 2015] [authz_core:error] [pid 10046:tid 139635174905600] [client 108.205.62.183:64784] AH01630: client denied by server configuration: /usr/lib/cgi-bin/hello.pl – MikeiLL Jun 04 '15 at 18:56

1 Answers1

2

First (useful) thing I did was just post a simple "hello world" script in the cgi-bin:

#!/usr/bin/perl

# hello.pl -- my first perl script!

print "Content-type: text/html\n\n";

print <<"EOF";
<HTML>

<HEAD>
<TITLE>Hello, world!</TITLE>
</HEAD>

<BODY>
<H1>Hello, world!</H1>
</BODY>

</HTML>
EOF

Still forbidden. Made sure all permissions were 755 for directories and 644 for files. Played around with changing ownerships of various files to and from root:root, myusername:www-data.

Someone at Linode (web hosting) recommended using to check file permissions:

sudo apt-get install tree
tree -puf /usr/lib | grep cgi
tree -puf /var/www

Shows a tree of files, ownerships and permissions. Cool!

Checked Apache error log:

$ sudo cat /var/log/apache2/error.log

Hmmm:

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

Posted a more useful question, joined the Debian email list and was referred to the docs: /usr/share/doc/apache2/README.Debian then got the following SO response:

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
</Directory>

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

Commented out the changes AWStats had made, ran a2enmod, restarted and 'Hello World' worked. Reinstated the AWStats configuration changes to etc/apache2/apache2.conf:

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
    Options None
    #Options Index FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

And there's AWStats in the browser. Awesome.

MikeiLL
  • 247
  • 1
  • 4
  • 10