0%

awstats 纯perl的方式 安装geoip插件

There is a rumor that GeoIP is not supported by Powweb. This is
completely false. It must first be configured prior to use. Now stay
with me so I don’t lose you…

  1. Install your own copy of

awstats in the cgi-bin directory. Once this is working properly, you
may move on to the next step. There is a tutorial for this on the
Powweb site under “Site Statistics” I believe.

  1. Download GeoIP::PurePerl module from Maxmind.com

http://www.maxmind.com/download/geoip/api/pureperl/

1.17 is the latest version as of Sept 1, 2005. This is a tar.gz file so make sure you have WinRAR or another compatible decompressor.

  1. Once

decompressed, create a directory in your cgi-bin called GeoIP (You can
name it anything you like, but for this tutorial it shall be GeoIP).
Move the contents from the decompressed folder to “/cgi-bin/GeoIP/”.
The decompressed folder should be called “Geo-IP-PurePerl-1.xx”. Now
before we configure we need to get the latest database.

  1. Download GeoIP.dat from this address

http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz

Again this is a .gz file and must be decompressed. Once decompressed, move “GeoIP.dat” to “/cgi-bin/GeoIP/”.

  1. OK.. now to configure.

First if you have turned on DNSLookup… turn it
off. In Awstats.conf —> DNSLookup=0 (this may also be a good time
to change your logfile if you desire current stats over stats from
yesterday. Remove the “.0″ after “access”.

LogFile=”/logs/access.0/1/xxxxxx_access_log” ->
LogFile=”/logs/access/1/xxxxxx_access_log”)

  1. Next enable the

GeoIP plugin by removing the # from before the command and add the path
to the GeoIP.dat file. In Awstats.conf —> LoadPlugin=”geoip
GEOIP_STANDARD /www/u/username/cgi-bin/GeoIP/GeoIP.dat” When that’s
complete, save awstats.conf

  1. Now open up the geoip.pm file

(located in awstats/plugins…. thanx Aza) so we may edit it. At the
very top you’ll see two directory entries. They’ll say “Geo/IP.pm” and
Geo/IP/PurePerl.pm”. WE need to modify these to reflect the
installation path. Change them to
“/www/u/username/cgi-bin/GeoIP/lib/Geo/IP.pm” and
“/www/u/username/cgi-bin/GeoIP/lib/Geo/IP/PurePerl.pm” respectively.
Save and close.

  1. Last but not least, open up “PurePerl.pm”

located in “/cgi-bin/GeoIP/lib/Geo/IP”. On lines 79 and 83 you’ll fine
directory listings for “GeoIP.dat”. Change these to
“/www/u/username/cgi-bin/GeoIP/GeoIP.dat”. Save and close.

  1. Everything should be set now.

If it’s working, you’ll see a new column
added to “Hosts” in Awstats named “GeoIP Country”. This will list
countries for all IP addresses, even ones collected before
modification. The “Countries” area will show flags only for IP
addresses collected after the modification. If you have trouble, set
your crontab to execute awstats every minute. This is accomplished be
setting time to * * * * *. Then check your cronlog located in your logs
folder to view errors.

Erik Reedstrom
IT Department
www.BrokeHouse.com