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:
-
Connect to your Plesk server via SSH.
-
Install
perl-CPAN
package:# yum install perl-CPAN
-
Install the GeoIP module using these two commands:
# perl -MCPAN -e "install Geo::IP::PurePerl"
# perl -MCPAN -e "install Geo::IP"
-
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
-
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
-
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
-
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
-
Recalculate web statistics for all existing domains:
# plesk sbin statistics --generate-all-webstat
# plesk sbin statistics --calculate-all
-
Connect to your Plesk server via SSH.
-
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
-
Install the GeoIP module:
# perl -MCPAN -e "install Geo::IP::PurePerl"
# perl -MCPAN -e "install Geo::IP"
-
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
-
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
-
Recalculate web statistics for all existing domains:
# plesk sbin statistics --generate-all-webstat
# plesk sbin statistics --calculate-all