2009
09.15
Of course the first thing to do is installing awstats:
After that, I create a symlink from awstats.pl to my cgi-bin.
ln -s /usr/share/awstats/wwwroot/cgi-bin/awstats.pl \
/var/www/vhost/domain/subdomain/cgi-bin/
Then I make sure that Apache allows symlinks:
<directory "/var/www/vhost/domain/subdomain/cgi-bin">
Options FollowSymLinks
</directory>
Furthermore we need to add a few aliases
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
Now let’s configure awstats. Awstats configuration files are in /etc/awstats. Create a new configuration file (awstats.subdomain.domain.conf) and pay attention for these parameters:
LogFile="/var/www/vhost/domain/subdomain/log/access.log"
SiteDomain="subdomain.domain"
HostAliases="subdomain.domain"
Now we can run awstats by invoking:
perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl \
-config=subdomain.domain -update
Awstats will now analyze our logfile. You should see something like:
Create/Update database for config "/etc/awstats/awstats.subdomain.domain.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/var/www/vhost/domain/subdomain/access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 117)
Jumped lines in file: 117
Found 117 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
You should have a working awstats now. Access http://subdomain.domain/cgi-bin/awstats.pl?config=subdomain.domain to verify this.
Finaly, we can make our life a little bit easier by using a tool called AWStats Totals. This tool will (automatically) summarize for which domains we have generated statistics and make those available to us.
Installing AWStats Totals is really easy. The only thing you have to do is download it
cd /var/www/vhost/domain/subdomain/public_html
wget http://www.telartis.nl/files/awstatstotals.zip
unzip it
put it in place
mv awstatstotals/awstatstotals.php .
rm -R awstatstotals __MACOSX
What I do next is symlink it
ln -s awstatstotals.php index.php
Now, we should see a nice summary when we access http://subdomain.domain/index.php.
2009
09.15
In the default configuration of Apache, any page will contain a full signature of the server. Server signatures contain valuable information about installed software and can be read (and exploited) by worms and hackers. Therefore is it safer to turn off this behavior. This is how you do it:
Open Apache’s configuration file (httpd.conf or apache2.conf) and search for ServerSignature
ServerSignature can be set to On, Off or EMail. Set it to Off.
After that search for ServerTokens
ServerTokens can be set to:
- Prod (Server: Apache)
- Min (Server: Apache/1.3.0)
- OS (Server: Apache/1.3.0 (Unix))
- Full (Apache/1.3.0 (Unix) PHP/3.0 MyMod/1.2)
Set it to Prod, as you can see this reveals the least information.
If you use PHP on your webserver, another thing you can do is telling PHP not to show it’s version. To accomplish this, open PHP’s configuration file (php.ini), search for expose_php and set it Off.
Obvious, after making these changes, we have to reload Apache. On a Red Hat / CentOS machine we do this by invoking
On a Ubuntu / Debian machine we do this by invoking
/etc/init.d/apache2 reload
2009
09.15
If you happen to forget the root password or discover that for some reason you are unable to login, then you can make use of the --skip-grant-tables option of MySQL. This is how you use it:
First you have to stop MySQL
Then you start MySQL with the --skip-grant-tables option
/usr/libexec/mysqld --skip-grant-tables
After that, use the MySQL client
to execute the following queries:
UPDATE mysql.user SET Password=PASSWORD('####') WHERE User='root';
FLUSH PRIVILEGES;
2009
09.13
The numbers 1, 2, 3, … form the set of positive integers

The numbers …, -3, -2, -1 form the set of negative integers

The set of integers consists of the set of positive integers, the set of negative integers and 0

The set of rational numbers consists of the numbers that can be written as a quotient of two integers
where
and
are integers and
. We cannot divide by zero. All integers are rational; 2 is because 
Rational numbers can be represented by decimal number that terminate (e.g.
), or by nonterminating repeating decimals (e.g.
). Numbers that are represented by nonterminating nonrepeating decimals are called irrational numbers. An irrational numbers cannot be written as an integer divided by an integer (e.g.
,
). Together, the rational numbers and the irrational numbers form the set of real numbers.