≡ Menu

fedora core

Lighttpd logo

If you are new to Lighttpd, please see how to install and configure Lighttpd web server.

The Webalizer is a fast, free, web-server log files analysis program. It produces highly detailed, easily configurable usage reports in HTML format, for viewing with a standard web browser.
Statistics commonly reported by Webalizer include: hits; visits; referers; the visitors' countries; and the amount of data downloaded. These statistics can be viewed graphically and presented by different time frames, such as per day, hour, or month.

Install Webalizer

If you are using Fedora Core or Cent Os, type the following command to install
# yum install webalizer

If you are using Debian Linux Os, type the following command to install
# apt-get install webalizer

Webalizer configuration

Let us see how to configure Webalizer for the domain theos.in:

  • Domain name: theos.in
  • Webroot: /home/lighttpd/theos.in/
  • Webalizer Webroot: /home/lighttpd/theos.in/stats
  • Webalizer Reports directory: /home/lighttpd/theos.in/stats/out
  • Webalizer configuration file: /home/lighttpd/theos.in/stats/webalizer.conf
  • Webalizer state log file: /home/lighttpd/theos.in/stats/webalizer.current (This file stored incremental processing state for logs. This is useful for large sites that have to rotate their log files more than once a month [using logrotate] )
  • Webalizer the history file: /home/lighttpd/theos.in/stats/webalizer.hist (keeps the data for up to 12 months worth of logs i.e. you will be able to see last 12 months stats)
    Lighttpd log file location: /var/log/lighttpd/theos.in/access.log

To configure Webalizer, copy /etc/webalizer.conf file to your webroot/stats directory. Type the following commands:
# mkdir -p /home/lighttpd/theos.in/stats
# cp /etc/webalizer.conf /home/lighttpd/theos.in/stats/webalizer.conf

Now open /home/lighttpd/theos.in/stats/webalizer.conf file:
# vi /home/lighttpd/theos.in/stats/webalizer.conf

Setup LogFile location:
LogFile /var/log/lighttpd/theos.in/access.log

Make sure LogType is set to Lighttpd’s Combined web server log format:
LogType clf

Setup statistics report directory where you want to put the output files:
OutputDir /home/lighttpd/theos.in/stats/out

Setup the name of the history file:
HistoryName /home/lighttpd/theos.in/stats/webalizer.hist

Make sure you get stats for last 12 months:
Incremental yes

Specify the filename for saving the incremental data:
IncrementalName /webroot/home/lighttpd/theos.in/stats/webalizer.current

Define the hostname of report:
HostName theos.in

Setup DNSCache file name. Use the same file name for all your domains. This will speed up DNS name lookup (you need to create a directory /var/cache/webalizer):
DNSCache /var/cache/webalizer/dns_cache.db

To get accurate stats you need to hide your own site from stats:
HideSite theos.in

In addition, you need to hide your own site from referrals as it gives most referrals:
HideReferrer theos.in

Save and close the file.

Create a directory to store DNS cache file:
# mkdir -p /var/cache/webalizer

Generate test stats:
$ webalizer -c /home/lighttpd/theos.in/stats/webalizer.conf

Map /home/lighttpd/theos.in/stats/ directory to url:
Since /home/lighttpd/theos.in/stats directory is out of your default webroot (/home/lighttpd/theos.in/html) you will not able to see the stats by visiting url http://theos.in/stats/. You can take the help of Lighttpd's mod_alias to map urls. Open your configuration file and type following line:
# vi /etc/lighttpd/lighttpd.conf
Append following config directives:
alias.url = (
"/stats/" => "/home/lighttpd/theos.in/stats/out/"

Save and close the file. Restart the Lighttpd server:
# /etc/init.d/lighttpd restart

View your stats by visiting http://yourdomain.com/stats/ url . Here is sample stat from my own personal website (Click to enlarge images):

Lighttpd Webalizer stats # 1

Lighttpd Webalizer stats # 2

Lighttpd Webalizer stats # 3


Since your log contains lots of personal information of your visitors (such as IP address, Search string query and much more), it is a good idea to put statistic folder/directory in a password protected directory.

Rotating log files

Finally, you need to configure logrotate to rotate logs files with Lighttpd

Here is small script that does this. Debian or Ubuntu GNU/Linux does not comes with any SYS V init script (located in /etc/init.d directory) .

You create a script as follows and use it to stop or flush the iptables rules.

Please don't type rules at command prompt. Use the script to speed up work.

Procedure for Debian / Ubuntu Linux

A) Create /root/fw.stop /etc/init.d/fw.stop script using text editor such as vi:

echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT

(B) Make sure you can execute the script:
# chmod +x /root/fw.stop

(C) You can run the script:
# /root/fw.stop

A note for RedHat and friends Linux user

Please note that RedHat enterprise Linux (RHEL) and Fedora / Centos Linux comes with pre-installed script, which can be used to stop the firewall:
#/etc/init.d/iptables stop
Sample outputs:

Linux > Command line BitTorrent client

BitTorrent is the name of a peer-to-peer (P2P) file distribution protocol, and of a free software implementation of that protocol.

The BitTorrent client is a computer program developed by BitTorrent, Inc. used to download and upload files via the BitTorrent protocol. You can download python based command line BitTorrent client download for Linux/BSD/Mac OS X/UNIX link oses. This is quite useful, if you would like to download file remotely over SSH session. bittorrent.com offers bittorrent client in .deb (Debian Linux) or rpm (RedHat/Fedora Core/CentOS Linux) file formats.

To use the bittorrent in command line one you need to use command bittorrent-console or bittorrent-curses (see below for examples).

Step # 1: Find Python version

Make sure you download file according to your python version. Type following command to find out python version:
$ python -V

Python 2.4.2

Step # 2: Download bittorrent client

Use wget to download bittorrent client

Download bittorrent client for Debian Linux:

$ wget http://download.bittorrent.com/dl/bittorrent_5.0.3_python2.4.deb

Download bittorrent clientFor Red Hat / Fedora Core / Cent OS Linux

$ wget http://download.bittorrent.com/dl/BitTorrent-5.0.3-1-Python2.4.noarch.rpm

Step # 3: Linux Install BitTorrent client

First login as a root user (use su or sudo command). If you are using Debian Linux, use dpkg command install bittorrent client
# dpkg -i bittorrent_5.0.3_python2.4.deb
If you are using Red Hat / Fedora Core /Cent OS Linux, use rpm command install bittorrent client:
# rpm -ivh BitTorrent-5.0.3-1-Python2.4.noarch.rpm

Step # 4: Start using or downloading files

Use bittorrent client as follows:
$ /usr/bin/bittorrent-curses 'http://www.some.org/DesktopBSD.iso.torrent'
$ bittorrent-curses 'http://www.some.org/DesktopBSD.iso.torrent'
$ /usr/bin/bittorrent-curses '/path/to/file.torrent'
You can try out pure console based client bittorrent-console instead of curses based client:
$ bittorrent-console '/path/to/file.torrent'
$ /usr/bin/bittorrent-console 'http://www.some.org/DesktopBSD.iso.torrent'

Tips about using and Troubleshooting BitTorrent client

(A) If you get [Errno 2] No such file or directory, you need to use wget or lynx command to download .torrent file to local hard drive first. For example
$ bittorrent-curses 'http://www.mininova.org/get/some_file[222].torrent'
First download download .torrent file using any one of the following method:
$ lynx 'http://www.mininova.org/get/some_file[222].torrent'
When prompted save .torrent file to a hard-disk. Another option is use wget to download .torrent file:
$ wget 'http://www.mininova.org/get/some_file[222].torrent'
Now start the downloading as follows:
$ bittorrent-curses 'some_file[222].torrent'

(B) If you get error 'This seems to be an old Python version which does not support detecting the filesystem encoding. Assuming 'ascii', then upgrade your python version to 2.4.xx:

Debian user upgrade python version using apt-get command:
# apt-get update
# apt-get install python2.4

Red Hat Linux user try out:
# up2date python2.4
Fedora Linux user try out:
# yum install python2.4

Remember if you have both versions (python v2.3 and v2.4) installed, you need to run bittorent client as follows:
$ python2.4 /usr/bin/bittorrent-curses '/path/to/file.torrent'
Command line BitTorrent client should work with other UNIX like operating systems such as FreeBSD/OpenBSD/Solaris etc (as long as you have Python it should work).

The current client enables a range of features including multiple parallel downloads. It also intermediates peering between itself, source file servers (read as trackers) and other clients, thereby yielding great distribution efficiencies. The client also enables users to create and share torrent files. See help files for more information.

See also: