如何在Centos 6.3下使用awstats+GeoIP實現查看網站訪問歸屬地

來源:互聯網
上載者:User

awstats是一款國外開源的網站PV流量監視軟體,能夠通過擷取apache或nginx日誌資訊,將日誌內有用的資訊整合到html頁面顯示,由於解析日誌的內容非常細緻,所以圈裡很多都拿此作為網站PV資料參考。

之前介紹了如何在apache平台上搭載awstats,今天研究了一下午,終於將GeoIP外掛程式整合到awstats中,實現IP反向解析歸屬地功能。

系統內容:  centos6.3 x64

awstats:   awstats-7.1.1

GeoIP:     GeoIP-1.4.8

Geo-IP:    Geo-IP-1.27

Geo-IPfree:Geo-IPfree-0.2

一.部署環境:

1.關閉iptables和SELINUX

# service iptables stop

# setenforce 0

# vi /etc/sysconfig/selinux

---------------

SELINUX=disabled

---------------

2.安裝依賴包

# yum install perl-devel libtool -y

使libtool生效

# aclocal

3.安裝配置awstats傳送門:http://showerlee.blog.51cto.com/2047005/1174141

二.安裝配置GeoIP外掛程式:

1.這裡需要編譯安裝3個GeoIP編譯包,這3個包互相關聯,必須逐一安裝:

# wget http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.8.tar.gz

# tar zxf GeoIP-1.4.8.tar.gz

# cd GeoIP-1.4.8

# ./configure --prefix=/usr/local/GeoIP

# make && make install

由於筆者編譯GeoIP時自訂了安裝路徑,所以這裡需要載入關聯GeoIP模組庫

# echo '/usr/local/GeoIP/lib' >> /etc/ld.so.conf

# /sbin/ldconfig /etc/ld.so.conf

# wget http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.27.tar.gz

# tar zxf Geo-IP-1.27.tar.gz

# cd Geo-IP-1.27

關聯GeoIP庫檔案:

# perl Makefile.PL LIBS='-L/usr/local/GeoIP/lib' INC='-I/usr/local/GeoIP/include'

# make && make install

# wget http://search.cpan.org/CPAN/authors/id/G/GM/GMPASSOS/Geo-IPfree-0.2.tar.gz

# tar -zxvf Geo-IPfree-0.2.tar.gz

# cd Geo-IPfree-0.2

# perl Makefile.PL

# make && make install

2.下載MaxMind免費提供的GeoIP和GeoIPCityLite資料包:

# cd /etc/awstats/

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

# gzip -d GeoLiteCity.dat.gz

# gzip -d GeoIP.dat.gz

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.