setup awstats อย่างไร? by

28
Sep
0

Awstats คือเครื่องมือช่วยวิเคราะห์ stat ที่เข้าถึงของเว็บเราครับ จริงๆ Google Analytic ก็ช่วยส่วนนี้ไปเยอะแล้ว แต่ส่วนที่ Google Analytic ช่วยไมได้คือพวก Bandwidth ต่อวัน และพวก status page แปลกๆ เช่น 404, 500, 502 ครับ ซึ่งหน้านี้ของ Awstats ก็คือการนำเอา Access log ของเว็บมา “ย่อยให้อ่านง่าย” นั่นเอง

12call

มาดูวิธีการติดตั้งกัน (Solaris Joyent ครับ)

  1. pkgin install awstats หรือ apt-get install awstats
  2. copy /opt/local/etc/awstats/awstats.model.conf มาเป็น /opt/local/etc/awstats/awstats.www.example.com.conf (ใน debian คือ /etc/awstats/awstats.conf)
  3. แก้ไข awstats.www.example.com.conf ดังนี้
    LogFile /var/log/nginx/access.log (สำหรับ nginx)
    LogFormat=1
    SiteDomain=”www.example.com”
    DNSLookup=0
    DirData=”/var/awstats” (ใชเก็บฐานข้อมูลที่ crawl จาก access_log มาแล้ว)
    HostAliases=”example.com”
  4. สร้าง dir ตามที่ DirData ระบุในข้อที่แล้ว
  5. สร้าง shell script ไว้รันโดยข้างในระบุคำสั่งดังนี้/opt/local/awstats/cgi-bin/awstats.pl  -config=www.example.com -update -output > /path/to/awstats.html (หน้าดูสถิติ) (/usr/lib/cgi-bin/awstats.pl ใน debian)
    /opt/local/awstats/bin/awstats_buildstaticpages.pl -config=www.example.com -update -dir=/path/to/awstats_dir/ -awstatsprog=/opt/local/awstats/cgi-bin/awstats.pl  > /dev/null (หน้ารายละเอียดปลีกย่อยที่ต้องสร้างเป็น dir ไว้เก็บหลายๆ ไฟล์) (/usr/share/awstats/tools/awstats_buildstaticpages.pl ใน debian)
  6. chmod g+x shell_script ที่สร้าง
  7. ตั้ง cron รัน shell script ที่สร้างตามสะดวก
  8. แก้ไข /opt/local/etc/nginx/nginx.conf โดยเพิ่มดังนี้location ~ ^/icon/ {
    root /opt/local/awstats; #/usr/share/awstats for debian
    index index.html;
    access_log off;
    error_log off;
    charset utf-8;
    }
  9. เข้า /path/to/awstats.html ก็จะดู awstats ได้แล้วเย้

Enjoy this article?

Consider subscribing to our RSS feed!

ไม่มีความเห็น

ยังไม่มีความเห็น

ใส่ความเห็น

RSS feed for comments on this post

 เราชนะรอบ 4 | ยืมเงิน 3000 ด่วน | แอพกู้เงิน | แอพเงินด่วน | สินเชื่อออนไลน์อนุมัติทันที | Site Map | กู้เงินก้อน | กระเป๋าตัง | thisshop และ ยืมเงินฉุกเฉิน 5000 ด่วน