Ubuntu Linux Resource: Install and Use Ubuntu!

Webalizer: Running Multiple Sites On One Server

No need to have all your websites report into one webalizer log!

If you have multiple web sites running on your Ubuntu system, you first need to make sure that each website goes to it’s own log. If you don’t all the logs will end up in /var/log/apache2/access.log.

Here, you are basically doing a find and replace of access.log with the name of your site in each site in /etc/apache2/sites-available/SITE-FILE.

Edit the files in /etc/apache2/sites-available/[yoursite(s)]
They should look like this:

————————————————————————————
NameVirtualHost 192.168.1.XX

ServerAdmin webmaster@localhost
ServerName YOURSITE.com
DocumentRoot /var/YOURROOTDOC/

Options FollowSymLinks
AllowOverride All


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/YOURSITE.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/YOURSITE.log combined

—————————————————————————-
Then restart apache: /etc/init.d/apache2 force-reload

You will then want to copy /etc/webalizer/webalizer.conf to something like /etc/webalizer/YOURSITE.conf

When you run webalizer, run this command:

/usr/bin/webalizer -c YOURSITE.conf

This will read in the special configuration file that you just read.

Realize that now your rootdoc now has /var/ROOTDOC/webalizer in there and the world can see it.

Edit the /etc/apache2/httpd.conf and make it look like this for each website/rootdoc you have:


AllowOverride AuthConfig
AuthName “You are not authorized to be here.”
AuthType Basic
AuthUserFile /var/www/webalizer/.htpasswd
AuthGroupFile /dev/null
require user YOURNAME


AllowOverride AuthConfig
AuthName “You are not authorized to be here.”
AuthType Basic
AuthUserFile /var/www1/webalizer/.htpasswd
AuthGroupFile /dev/null
require user YOURNAME


…and so on.

Make sure that you create a .htpasswd and place this in each webalizer directory under each rootdoc. This will ensure that only you can see your stats.

Put these in your crontab and they will update each day.

Your crontab should look like this:


4 1 * * * /usr/bin/webalizer -c /etc/webalizer/SITEA.conf
6 1 * * * /usr/bin/webalizer -c /etc/webalizer/SITEB.conf
7 1 * * * /usr/bin/webalizer -c /etc/webalizer/SITEC.conf
8 1 * * * /usr/bin/webalizer -c /etc/webalizer/SITED.conf
9 1 * * * /usr/bin/webalizer -c /etc/webalizer/SITEF.conf

Enjoy!