• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

awstats install guide for beginners

Still a little lost...

Thank you for all the great instruction on this subject! However, I'm still running into a problem.

Everything seems to work and the stats are even generated, but I can never access the stats or view them at all.

I'm assuming that I should be able to go to http://www.mydomain.com/awstats to view them, but it doesn't work.

A text file is generated in the folder that I specify, but there aren't any .html files that I can see at all.

Let me know if I'm missing something, or doing something wrong, please.

Thanks!

John
 
OK, but more info on how far you are would make it easier...

If I assume that you've awstats installed, and that you've installed it as root, and that you've made the symlinks and the vhost.conf changes on the domain and restarted apache, and that an awstats.domain.tld.conf is made in /etc/awstats/ for the domain, (now you see why I'm asking eh) - you need to do the

/usr/local/awstats/tools/awstats_updateall.pl now

to make AWstats generate the logfiles it needs to generate the final HTML (also see the AWstats docs, the updateall is well described and you can add params to test configs and have it debug the process somewhat).

Then, on about ½ the domains I'm able to use http://(www.)domain.tld/awstats/awstats.pl?domain=www.domain.tld (actually I seem to be able to skip the ?... part, it still only shows what it should).

On the other half I also get the 403... so far I've no idea why, but I'll be testing that +followsymlinks above and see if it's better. For the ones with problems I've so far build manual html files - go to the wwwroot/cgi-bin folder of awstats and run
perl awstats.pl -config=domain.tld -output -staticlinks > awstats.html
and then moved that file to the domain folder for the user to access. Not good, but well... hope this helps anyway.
:)

Oh and a not-to-miss AWstats resource site:
http://www.antezeta.com/awstats.html


[edit]

Well couldn't quite think up a way to make Plesk use the hosts own name in the link on a button, so I instead link to a redirection script on a centra site (the default site on the server, my hostingsite).

Code:
<?php
/*
###############################
# AlleyKat gotouser_awstats.php
# Redirects users clicking a button in Plesk to AWstats via a central site.
# Called with 
# gotouser_awstats.php?allowaccess=yes&dom_name=<dom_name>
###############################
*/

if ( !isset($_GET["accessallowed"]) || ($_GET["accessallowed"]!=="yes") || !isset($_GET["dom_name"]))
{

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <head>
              <title>Error</title>
        </head>
        <body>
      No access to this script directly.
      <br />
      <a href="http://localhost/">Please leave this page thank you!</a>
        </body>
      </html>
<?php
die();
}

$thedomain = htmlentities($_GET['dom_name']);

if (ereg("^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$", $thedomain))
{

$thelink = $thedomain."/awstats/awstats.pl?domain=".ereg("^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$", $thedomain);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <head>
        <title>Redirection to <?= $thedomain ?> AWstats</title>
        <meta http-equiv="REFRESH" content="4;url=http://<?= $thelink ?>">
  </head>
  <body>
Redirection to <b><?= $thedomain ?></b>'s AWstats
  </body>
</html>
<?php

} else {
         die("Try hacking somebody else's site.");
}
?>
and (as Plesk admin) make a Domain Administrator button with the link to the site
http://myhostingpage/path/gotouser_awstats.php?allowaccess=yes
and add the param
&dom_name=<dom_name>
Bingo, button shortcut to AWstats on all domains (where it works - now to figure out the problem). :D
 
403...

Thanks a lot for the response.

Now, I am to the point where I can view the stats with /awstats/awstats.pl

But, I get the 403 error on the domain.

Also, is there any way to update the stats every 6 hours or so w/cron?

It would be great if I could figure out how to get rid of the 403 error.

Also, it put all the awstats folders in the httpdocs instead of /awstats/ ...

So, I have a lot of awstats folders in the main httpdocs folder...

Thanks - John
 
CGI-BIN

I just figured out that awstats won't work at all if I have the cgi-bin enabled...

I read about this at the beginning of the post - but what's the solution??
 
Firstly, to ProfiTiger and crew - thanks very much for this posting, it really helped us get awstats ging on the box.

We've come up against an issue which has happened with a Joomla installation, and I suspect would hapen with Mambo too.

Basically, the .htaccess file that Joomla uses if you want it to create SE friendly urls mucks up the access to awstats.

The contents of the .htaccess file are:

##
# @version $Id: htaccess.txt 1570 2005-12-29 05:53:33Z eddieajau $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

Options +FollowSymLinks

#
# mod_rewrite in use
#

RewriteEngine On

##
## NOTE!
## When using multiple Joomla sites or other web applications in sub-folders,
## you must explicitly turn the RewriteEngine off or use the settings
## recommended for the application
##

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update YourJoomlaDirectory (just / for root)

# RewriteBase /YourJoomlaDirectory

#
# Rules
#

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

When this is activated and you try to access awstats via the /awstats/awstats.pl?config=yourdomain.com url we get the message:

You don't have permission to access /awstats/awstats.pl on this server.

The server logs show:

[Fri Mar 10 14:48:07 2006] [error] [client xx.xx.xx.xx] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/yourdomain.com/httpdocs/awstats/awstats.pl


If you remove .htaccess everything works fine. I've seen a lot of postings about this around the net, but noone seems to have got an answer, certainly not for this situation.

I ugess there must be some people using SE friendlu urls with Mambo/Joomla and are also running awstats on their plesk box.

If anyone could give some advice here I'd really appreciate it.

Regards, Steve.
 
I had a thought. I wonder if it is possible to verify that the HTTP_USER=domain-user or whatever. If it is allow the page to load, if not give access denied message. That way a user who goes in through the control panel will be able to access the page, but no one else. Any thoughts?


Jim
 
Jim,

Could you explain your issue a bit more?

Also, can anyone help with the Mambo .htaccess issue as desribed above? There must be someone else who has seen this problem in action?

Thanks, Steve
 
well, basically, my domain users will already have been logged on to their Plesk Control Panel. I don't see a need to have them log in again. I would like to know if there is a way (in vhost.conf possibly) to check that the user is authenticated, then allow them to view the statistics. Having to log in again is not something many users want to experience.

As for the problem you have been having with the .htaccess file: It seems like the ReWriteCond are being applied to the entire vhost, not just the joomla dir. Have you tried settin ReWriteBase to your joomla dir? Not sure if it makes a difference but worth a try..
 
We fixed this - this is the entry on our company wiki on how to do so:

When you try to add the stats to a Mambo/Joomla instal you get a 403 error - in the log file you'll probably see:

" Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden"

To fix this you should ideally add:

<Files ~ (\.pl)>
Options ExecCGI FollowSymLinks
</Files>

to /home/vhosts/*/conf/vhost.conf

However, this doesnt always work (reason unknown) in which case add it to the httpd.include file directly (but be aware that if plesk makes changes to the site (such as enabling SSL on a website) it will scrub over it. The addition in httpd.include is to make:

<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>

look like:

<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI FollowSymLinks
allow from all
PerlSendHeader On
</Files>


KInd regards, Steve
 
Hello, there's some things that i dont understand...

1/ ProfiTiger you wrote:
> then I've commented out following strings in vhost.conf for domain.name:
>
> Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
> Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
> Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"

but in your script, the vhost.conf is:
# Directives to allow use of AWStats as a CGI
ScriptAlias /awstats/ "/home/httpd/vhosts/$1/httpdocs/awstats/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/home/httpd/vhosts/$1/httpdocs/awstats/">
Options none
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory "/home/httpd/vhosts/$1/httpdocs/logs">
AuthType Basic
AuthName "AWSTATS"
AuthUserFile /home/httpd/vhosts/$1/pd/d..plesk-stat
require valid-user
</Directory>

So my question is: What is exatly inside vhost.conf ?

2/ You wrote:
> and changed paths in ScriptAlias and <Directory>:
>
> -ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
> +ScriptAlias /awstats/ "/home/httpd/vhosts/domain.name/httpdocs/awstats/"
> -<Directory "/usr/local/awstats/wwwroot">
> +<Directory "/home/httpd/vhosts/domain.name/httpdocs/awstats/">

Does it mean that we have to change this lines in /etc/httpd/conf/httpd.conf ?

3/ Then my last question is:

Are all the awstats folders have to be as root ? or some have to be as apache ?

Thank you very much
 
Has anyone ever figured out a server wide solution that will install on all existing vhosts as well as any future new vhosts?

TIA,
aaabyss
 
So my question is: What is exatly inside vhost.conf ?
Does it mean that we have to change this lines in /etc/httpd/conf/httpd.conf ?

NEVER touch httpd.conf on a server with virtual hosting/plesk because it gets overwritten by plesk. For the case you have to do manual changes to apache-configuration, plesk uses an "extension" of httpd.conf which is located in home/httpd/vhosts/domainname/conf and is named vhost.conf. It uses the same syntax as httpd.conf.



Are all the awstats folders have to be as root ? or some have to be as apache ?

Not sure. Think root is not required, should be wwwrun / apache for
usr/local/awstats/wwwroot and subdirectories.

Can not give you an perfect answer because our server chrashed and i had no time to reinstall awstats until yet.
 
Vhost.conf file

First at all, thanks to all the people that write in this threat, was very usefull to install the awstats.
I have the same question of davidfer

ProfiTiger you wrote:
> then I've commented out following strings in vhost.conf for domain.name:
>
> Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
> Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
> Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"

I see in my server (SUSE 9.1 with plesk 7.5.3 reloaded) and in my conf folder for the domain, just have this files

httpd.include
httpd.include.bak
webalizer.conf

I see the http.include and have a big title that said Don't change this file... use the vhost.conf

So, I don't know where I have to change those aliases and the scripts
Where I found the file to modify this

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/"
+ScriptAlias /awstats/ "/home/httpd/vhosts/greciaautos.com/httpdocs/awstats/"
-<Directory "/usr/local/awstats/wwwroot">
+<Directory "/home/httpd/vhosts/greciaautos.com/httpdocs/awstats/">

Thanks in advance for your help

Fabián
 
I was having trouble installing awstats on my Plesk + Joomla installation and here is what I had to do to keep from having the 403 forbidden errors:

<Files ~ (\.pl)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
to /var/www/vhosts/*/conf/httpd.include was overriding everything else. Adding:

<Files ~ (\.pl)>
Options ExecCGI FollowSymLinks
</Files>

to /var/www/vhosts/*/conf/httpd.include seems to have resolved all of the mod_rewrite problems.
 
Back
Top