You can find the two contents in the “wwwroot” folder. With the help of File Manager (in cPanel) or FTP upload the contents of /cgi-bin and /icon folders into the root of domain.Create a folder and extract the contents to it.First of all, visit and download Awstats on your PC.with ) in each configuration (apache and awstats) and setup the directory in /var/lib/awstats.This post is definitely to serve people looking for an alternative to access and view Awstats without requiring to sign in to cPanel. To set this up for another vhost just replace the name (e.g. Point your browser to and enjoy your statistics. Now reload apache: /etc/init.d/apache2 reload I use apache mod_env to pass an environment variable to all scripts in /server/awstats/ containing the name of the vhost which I want statistics to show up for.īesides this I set up authentication for this location using mod_authnz_ldap but mod_authn_file would also do. Require ldap-group cn=admins,ou=groups,dc=fladi,dc=at SetEnv AWSTATS_FORCE_CONFIG AuthType BasicĪuthName "Statistik: AuthLDAPURL "ldap://127.0.0.1/dc=fladi,dc=at?uid" To make the statistics show up on each vhost, the vhost config has to be extended by a simple block. Now statistics will be updated every ten minutes. awstatsprog=/usr/lib/cgi-bin/ -configdir=/etc/awstats/ >/dev/null" \ If there are no errors in the output, you can set this up as a cronjob: echo "*/10 * * * * awstats /usr/share/doc/awstats/examples/awstats_ now \ awstatsprog=/usr/lib/cgi-bin/ -configdir=/etc/awstats/" awstats su -c "/usr/share/doc/awstats/examples/awstats_ now \ This skript is part of the debian awstats package. Also make sure that logrotate honors your decision of user/group in /etc/logrotate.d/apache2.Īfter a while, when there's some data in the new log files run the script /usr/share/doc/awstats/examples/awstats_ which updates statistics for all configurations in /etc/awstats. Make sure that the new log files are in /var/log/apache2 and that they are readable by group "adm" (or any other group/user you choose to use for awstats). Now it's time to restart apache to get the new separated log files populated: /etc/init.d/apache2 restart Now make the new user the owner of the directory structure in /var/lib/awstats: chown -R awstats:adm /var/lib/awstats My logfiles in /var/log/apache2 are readable by group adm (seems to be the default Debian setting) that's why I choose "adm" for the primary group of the user "awstats". It's the directory I defined at "DirData": mkdir /var/lib/awstats/To make things secure I create a user for running AWStats and make him member of the "adm" group: useradd -r -d /var/lib/awstats/ -g adm awstats Now we need to create the new folder where the statistical data gathered from the logs will be stored. But be warned that AWStats has had several critical vulnerabilities in it's past! You can leave AllowAccessFromWebToAuthenticatedUsersOnly set to "0" if you don't want to make sure that authentication is required to view the statistics. In /etc/awstats I copy the existing nf to awstats.cp /etc/awstats/nf /etc/awstats/awstats.I modify the following directives in the new configuration /etc/awstats/awstats.LogFile="/var/log/apache2/access.LogType=W Make sure, that the "combined" logging format is available! Second, I granted every vhosts it's own log files, for example -(1035:Don,10 Apr 08:$)- cat /etc/apache2/sites-available/ĭocumentRoot /var/ServerName CustomLog /var/log/apache2/bined I choose it to later make sure that visits to AWStats pages don't get counted in the statistics. The alias /server-awstats/ can be customized to any name you see fit. ScriptAlias /server-awstats/ /usr/lib/cgi-bin/ I'm still on Debian Sid so I'll use the awstats package from the repository: aptitude install awstatsįirst, I made AWStats available to all vhosts by placing it's apache configuration in /etc/apache2/conf.d/nf where it get's included automatically on apache startup: -(1036:Don,10 Apr 08:$)- cat /etc/apache2/conf.d/nfĪlias /server-awstats/icon/ /usr/share/awstats/icon/ I decided it was time to rework my whole approach on using logging and gathering statistics. AWStats was running only one configuration instance and in the end it was impossible to get the statistics for only one vhost. All vhost were logging into one access.log and one error.log. After having accumulated more and more vhosts on my domain, the statistics started to become messed up. I'm running AWStats for my web servers ( Apache 2) for several month now but I only take a look at those fancy statistics once in a while.
0 Comments
Leave a Reply. |