Assume that the system is centos.
First download
Ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.23-05-src.tgz
Then,
Yum install gd
Yum install gd-devel
Tar zxvf webalizer-2.23-05-src.tgz
Cd webalizer-2.23-05
./Configure -- with-language = simplified_chinese
Make
Make install
Cp/usr/local/etc/webalizer. conf. sample/etc/webalizer. conf
Vim/etc/webalizer. conf
======================================
Add
LogFile/data1/logs/wwwlogs. log # enter the nginx log File
# Nginx. conf is required to be similar to access_log/data1/logs/wwwlogs. log combined;
LogType clf
OutputDir website document root directory/logs
# Replace "website document root directory" with the actual path
# The logs directory must be created in advance and can be written as needed.
Incremental yes
Faster
======================================
Now, every time you execute
/Usr/local/bin/webalizer-c/etc/webalizer. conf
The system automatically adds html and images to the logs directory.
Http: // domain name/logs/index.html
The statistical result is displayed.
For automation, Edit
Vim/etc/crontab
Join
0 1 *** root/usr/local/bin/webalizer-c/etc/webalizer. conf
Then save
Run
/Etc/init. d/crond restart
Supplement
1. so that anyone can see the log, so the directory name can be changed, or the authentication mechanism can be used.
2. If the website is UTF-8 encoded
Charset UTF-8
Such settings. Then, garbled characters are displayed in the log. To solve this problem,
Vim nginx path/conf/nginx. conf
Add
Location/logs {
Charset gb2312;
}
You can.
To make it easier to view logs, you can modify the above
Vim nginx path/conf/nginx. conf
Add
Location/logs {
Charset gb2312;
Index index.html;
Server_name_in_redirect off;
}
Author "xieye"