Installing AWStats on Fedora (FC4) with Apache virtual hosting

While the exact distribution probably doesn’t matter too much, some steps are pertinent only to Fedora (i.e. the Yum install). Honestly, follow the instructions in the awstats documentation closely and you should be fine. My point here is to point-out some of the finer details.

First step, install AWStats as root:
% sudo yum install awstats

Yum will install awstats into /usr/share/ (/usr/share/awstats)

Now run the configuration script
% cd /usr/share/awstats/tools/
% sudo perl awstats.pl
.....

When it asks for the location of the server configuration file:
/etc/httpd/conf/httpd.conf (your apache conf file)
follow the remaining direction until you exit the configuration script. For the sake of this tutorial I’ll call the site “mysite.”

NOTE: Apache logs are typically in the common log file format. AWStats works to its fullest potential if you change the log file format to combined in your httpd file. If you choose to keep the common file format, you’ll have to make the appropriate changes in awstats.

Now configure the awstats config file you just created with the above script:
% sudo emacs /etc/awstats/awstats.mysite.conf

You’ll need to edit a few lines to get everything working:
(line 51) LogFile="/var/path/to/my/file_access.log"

(line 153) SiteDomain="subdomain.domain.ext"

#and any others you might be using
(line 168) HostAliases="subdomain.domain.ext 127.0.0.1 localhost"

#Optional, but improved security. Leaving this blank allows ALL, otherwise fill-in the IPs that you want to allow
(line 349) AllowAccessFromWebToFollowingIPAddresses="127.0.0.1"

One thing I was unable to get working correctly with HTTP authentication was:
(line 328) AllowAccessFromWebToAuthenticatedUsersOnly=1
and
(line 339) AllowAccessFromWebToFollowingAuthenticatedUsers = "__REMOTE_USER__"

Ok!

now run the awstats.pl script:
% cd /usr/share/awstats/wwwroot/cgi-bin/
% sudo perl awstats.pl -update -config=mysite

If all goes well, you should see something along the lines of:
Found 0 dropped records
Found 0 corrupted records,
Found 150 old records,
Fount 50 new qualified records.

…at the end of the update script output.

So, to do this with multiple domains, just repeat the steps above, making sure to make the appropriate changes to each domain…

You should now be able to visit http://www.yoursite.ext/awstats/awstats.pl?config=mysite and you’ll see the fruits of your labor. I chose not to allow web users to do automatic updates. Rather, I have a cronjob set to run the awstats.pl -update script a once per day
(I don’t administer any high-traffic sites, so it’s not critical to have the most up-to-date records). You can see near the end of my Incremental backups with rsync post for more information on that, if you’re interested.

A word of caution: AWStats is often the target of worm attacks through XSS (cross-site scripting). One reason to use Yum to install/manage awstats is that you don’t have to do any of the work to keep it updated (make sure you enable automatic yum updates in your systems services config (menu: Desktop->System Settings -> Server Settings -> Services; check the “yum” option is checked and you click the “Start” button while it’s highlighted). Also make sure to limit who can see the awstats reports.

Advertisements
Tagged

8 thoughts on “Installing AWStats on Fedora (FC4) with Apache virtual hosting

  1. curseddagger says:

    Perfect!

    thank you very much. i had a bit of trouble installing awstats at first but i read your short guide and it finally made sense :D

  2. tripleman says:

    I have to say, your instructions made all the difference in setting awstats up. You really were able to point out the key things and get me on the right track.

    Thanks a lot.

    tripleman

  3. arkanoid says:

    Thank’s a lot dude !!! I really appreciate the job you did, since it saved lot of mine !

    You are great !!!

  4. thanks a lot. now awstats helps track statistics for our press release distribution site.

  5. google.com says:

    Currently it appears like Movable Type is the best blogging platform available right now.
    (from what I’ve read) Is that what you are using on your blog?

  6. google.com says:

    Hey! I’m at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading your blog and look forward
    to all your posts! Keep up the great work!

  7. Hi there every one, here every person is sharing these kinds of know-how, so it’s pleasant to read this webpage, and I used to visit this
    webpage all the time.

  8. Thank you for every other informative blog. The place else may just I am getting that kind
    of information written in such an ideal way? I have a undertaking that I’m just now operating on, and
    I’ve been at the glance out for such information.

    my web-site: [lift master garage door opener](http://www.youtube.com/watch?v=-Il3XI5GuA8 “lift master garage door opener”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements
%d bloggers like this: