Install webalizer for nginx

Source: Internet
Author: User

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"
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.