Webalizer statistics on DreamHost

In my last post, I detailed the way in which you could activate the Analog statistics application on DreamHost accounts with root WordPress installations. I’m really not a fan of Analog, though – my preferred application for statistics tracking is Webalizer.

I’ll describe the best way to install Webalizer in this shared hosting environment, with information distilled from the DreamHost Customer Support Wiki.

First, you’ll need shell (SSH) access to your Dreamhost account. Once you’ve logged in, carry out the following tasks:

  1. Make a new directory in your home path called webalizer. Also make a new directory for your domain’s statistics.

    mkdir ~/webalizer
    mkdir ~/example.com/webalizer

  2. Change to the directory.

    cd ~/webalizer

  3. Open a new links browser instance to the Webalizer download page.

    links http://www.mrunix.net/webalizer/download.html

  4. When Links opens, press Enter to bypass the information box if it appears.
  5. Arrow down to the Linux ELF – Binary x86 link. (You don’t need the static binary.) Press d to download the file, and then press Enter to save the .tgz file.
  6. Once the file is downloaded, press q and then Enter to exit Links.
  7. Extract the .tgz file (change the version number if necessary).

    tar -zxf webalizer-2.01-10-linuxelf-x86-bin.tgz

  8. Move the contents of the versioned Webalizer directory to the ~/webalizer directory, and delete the version numbered extraction directory.

    mv webalizer-2.01-10-linuxelf-x86/* .
    rm -rf webalizer-2.01-10-linuxelf-x86/

  9. Copy the sample.conf file to a new file with your domain name.

    cp sample.conf example.com.conf

  10. Edit the example.com.conf file using your preferred editor. You will want to uncomment and change the following lines to reflect the DreamHost configuration:

    TheLogFile line should read:
    LogFile /home/username/logs/example.com/http/access.log.0

    The OutputDir command should be:
    OutputDir /home/username/example.com/webalizer/

    The Incremental option should be enabled:
    Incremental yes

    And the IncrementalName directive should be uncommented:
    IncrementalName webalizer.current

  11. Save the file, then run the webalizer application:

    ./webalizer -c example.com.conf

  12. Browse to your site’s webalizer directory and view the statistics. The URL is:

    http://example.com/webalizer/

In order to retrieve each day’s statistics and have Webalizer parse them, you need to set up a cronjob to automatically run each day after midnight. 2 AM is about the best bet for the cycle to run.

  1. Set your EDITOR variable to vi, so that your commands all are on the same line.

    export EDITOR=vi

  2. Edit your crontab file:

    crontab -e

  3. Add the following line to the crontab file. (Press i for Insert mode to begin typing in vi. To exit, type :wq.)

    0 2 * * * /home/username/webalizer/webalizer -c /home/username/webalizer/example.com.conf >/dev/null 2>&1

Your cronjob will now run at 2AM every day, processing the previous day’s log entries.


If you want to secure your /webalizer/ directory from prying eyes, you can create a .htaccess file under ~/example.com/webalizer/ with the following information:

AuthName "Webalizer Statistics"
AuthType Basic
AuthUserFile /home/username/example.com.stats.htpasswd
Require valid-user

Then, use Apache’s htpasswd tool to create the .htpasswd file:

htpasswd -c /home/username/example.com.stats.htpasswd useraccount

You will be prompted for a password for the user account. To add more users to this file, run the htpasswd command without the -c flag:

htpasswd /home/username/example.com.stats.htpasswd anotheruser


While there’s a lot of information to digest, Webalizer is an excellent tool for tracking web statistics and the user interface is slightly more friendly than Analog. I plan to use the two applications concurrently – Analog seems to do a better job of tracking referral URLs and Webalizer provides colourful graphs.

Update 3/07/2007: I’ve updated the crontab section to reflect that the full /home/username/webalizer/example.com.conf path needs to be passed for the -c flag.

DreamHost statistics with a root WordPress installation

If you own one or more of the 350K domains hosted with Dreamhost, you may be interested in using their statistics tracking system. However, if you have WordPress installed at the root of your domain, the /stats/ URL is inaccessible and only results in a 404 error, as WordPress tries to parse /stats/ as a permalink to a post or page. This is due to the .htaccess directives that WordPress employs.

The solution is on the DreamHost wiki and can be added to the top of your .htaccess file fairly quickly:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html)/?(.*)$ [NC]
RewriteRule ^.*$ - [L]
</IfModule>

This code comes before the WordPress commented line:
# BEGIN WordPress

Alternatively, if you’re concerned about people possibly bruteforcing your statistics username and password (since it uses simple HTTP authentication), you can deny public access to /stats/ and access the logfiles from an SSH session. Keep in mind that this will be a text-based view of your statistics.


ssh user@yourdomain.com
cd logs/yourdomain.com/http/html
links index.html

The logs directory is accessible under your home directory (~). You could also always run a tar/gzip command on the ~/logs/yourdomain.com/http/html directory and SFTP/FTP the file, then view the stats locally.

For more information, such as performing the same operation with Ruby on Rails apps or TextPattern, check the wiki.

VNC on a Mac? Use Vine.

Thanks to Dave for this pointer:

The default VNC application on OS X really bites, so if you want to access your Mac remotely, get a copy of Vine Server.

For viewing the result on a PC, install UltraVNC and use the following connection settings for best results. (This assumes you’re on a local area network – both wireless and wired worked fine for me.)

UltraVNC Settings Dialog

ev98.net is now live again

Barring any monkey business… ev98.net works again. Carry on as usual. Please report any errors and I’ll crank out a fix as soon as is possible.

In other news, co-op rankings begin Friday at 1pm. Good luck to any UW-goers in this process.

In other news, I just wrote an essay for English that has made me enraged at slippery slope arguments. Why must people continue to prove Godwin’s Law, even in professional writing?