Plesk

How to configure GeoIP plugin for Plesk AWStats

Question

How to configure AWStats to show which countries visitors are from?

Answer

By default, AWStats does not show visitors by countries.

If you wish to see this functionality in AWStats for Plesk out of the box, please vote for this feature on Plesk UserVoice:

 

To enable this feature manually, configure the GeoIP plugin as follows:

 

For Plesk on CentOS/RHEL-based distributions

 

  1. Connect to your Plesk server via SSH.

  2. Install perl-CPAN package:

    # yum install perl-CPAN

  3. Install the GeoIP module using these two commands:

    # perl -MCPAN -e "install Geo::IP::PurePerl"

    # perl -MCPAN -e "install Geo::IP"

  4. Run these commands to uncomment the plugin in AWStats configuration files:

    # /bin/sed -ire '/GeoIP.dat/ s/^#//' /etc/awstats/awstats.conf

    # /bin/sed -ire '/GeoIP.dat/ s/^#//' /etc/awstats/awstats.model.conf

  5. Run these commands to correct the path:

    # /bin/sed -i 's//pathto/GeoIP.dat//usr/share/GeoIP/GeoIP.dat/g' /etc/awstats/awstats.conf

    # /bin/sed -i 's//pathto/GeoIP.dat//usr/share/GeoIP/GeoIP.dat/g' /etc/awstats/awstats.model.conf

  6. Run this command to uncomment the line for all existing domains which are using AWstats:

    # for file in /usr/local/psa/etc/awstats/*; do /bin/sed -ire '/GeoIP.dat/ s/^#//' "$file"; echo "$file is updated"; done

  7. Run this command to correct path to GeoIP plugin:

    # for file in /usr/local/psa/etc/awstats/*; do /bin/sed -i 's//pathto/GeoIP.dat//usr/share/GeoIP/GeoIP.dat/g' "$file"; echo "$file is updated"; done

  8. Recalculate web statistics for all existing domains:

    # plesk sbin statistics --generate-all-webstat

    # plesk sbin statistics --calculate-all

 

For Plesk on Debian/Ubuntu-based distributions

 

  1. Connect to your Plesk server via SSH.

  2. Check if the make utility is installed on the server:

    # which make

    If this command's output is empty, install the required package:

    # apt-get install make

  3. Install the GeoIP module:

    # perl -MCPAN -e "install Geo::IP::PurePerl"

    # perl -MCPAN -e "install Geo::IP"

  4. Run these commands to uncomment the plugin in AWStats configuration files:

    # /bin/sed -ire '/GeoIP.dat/ s/^#//' /etc/awstats/awstats.conf

    # /bin/sed -ire '/GeoIP.dat/ s/^#//' /etc/awstats/awstats.model.conf

  5. Run this command to uncomment the line for all existing domains which are using AWstats:

    # for file in /usr/local/psa/etc/awstats/*; do /bin/sed -ire '/GeoIP.dat/ s/^#//' "$file"; echo "$file is updated"; done

  6. Recalculate web statistics for all existing domains:

    # plesk sbin statistics --generate-all-webstat

    # plesk sbin statistics --calculate-all