AWStats Issue Adding GeoIP and GeoIP City DATs with PM Missing

Mindwatering Incorporated

Author: Tripp W Black

Created: 08/25/2018 at 02:37 PM

 

Category:
Linux
Other

Issue:
Noticed after a system update AWStats w/NGINX showing an error page for the AWStats page.
There ended up being two issues to fix.


Error Message #1:
The web server displays the following error:
502 Gateway

Checked the AWStats error log, and found issue:
$ tail /var/log/nginx/awstats.mwstream.mindwatering.net.error.log
...
server: localhost, request: "GET /cgi-bin/awstats.pl?config=mwstream.mindwatering.net HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "mwstream.mindwatering.net:9999"
...

Solution #1:
$ sudo systemctl status php7.2-fpm
< printed last successful load history>
The update had upgraded php from 7.0 to 7.2.

Updated nginx.conf:
$ sudo vi /path/to/nginx/conf/nginx.conf

Updated the third line below, changing the 7.0 to 7.2:
...
location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
gzip off;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
...
$ sudo systemctl restart nginx



Error Message #2:
. . .
Plugin load for plugin ‘geoip’ failed with return code: Error: Can’t locate Geo/IP.pm in @INC


Tried AWStats Update Tool:
$ sudo /usr/share/awstats/tools/update.sh
<Same error message as the ones in the left column and main page of the AWStats main page>

Verified AWStats installed
$ sudo apt-get update
$ sudo apt-get install awstats
< Already newest version returned >

Verified Geo-IP module installed:
$ sudo apt-get install libnginx-mod-http-geoip
< Installed but had an update, answered Y to update >

Checked awstats.conf for dat paths:
$ sudo vi /etc/awstats/awstats.conf.local

LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoLiteCity.dat"

$ sudo ls -l /usr/share/GeoIP/
< This directory contained all the linked files, as expected. >

Solution #2:
Reinstalled Perl Modules:
$ sudo cpan Geo::IP::PurePerl Geo::IP

Ran update again successfully:
$ sudo /usr/share/awstats/tools/update.sh
<nothing printed out - success>

Returned to web browser and reloaded page successfully. Both country and city columns are now present and displaying data under Hosts section.


previous page

×