Just set it up, all good. Thank you!

Bonus if Awstats comes with password protection - shame it doesn't have it. I'll find a way to protect this from public eyes.

  • sean replied to this.
    5 days later

    Thanks for this tutorial!

    I believe there is a slight mistake in step 6. You forgot to include appname in the path for the awstats.conf file.

    Also, is it possible to get GeoIP setup with this so we can see from which countries hits are from? I tried to get GeoIP working with GoAccess last week but didn't have any luck 🙁 I'm a bit of a noob to this kind of stuff.

    • sean replied to this.

      Hodson step 6 fixed, thanks for catching that.

      I'll try to sort out GeoIP and will follow up here when I do.

      4 days later

      Is anyone having issue with getting the data to appear for

      • Keywords used on search engines
      • Keyphrases used on search engines

      Mine shows up as zero

      • sean replied to this.

        tsutton do you have entries in your site access logs (eg ~/logs/sites/sitename/access.txt) that show search engine keywords in the referring URLs? Most search engines (including Google) scrub them before handing the request off to your site.

        10 days later

        Hodson is it possible to get GeoIP setup with this so we can see from which countries hits are from?

        I was able to get GeoIP working with the following steps:

        1. Register for an account at maxmind.com.
        2. Download the MaxMind GeoLite2 City and Country databases (binary mmdb, not CSV) from your MaxMind account and upload them to your AWStats app's shell user account. I used the GeoLite2 databases because they are free, but if you have a paid account then you can use the full GeoIP2 databases.
        3. Edit your app's awstats.conf to enable the related plugins. The sections should already be present, you only need to uncomment the LoadPlugin lines for GeoIP2 City and Country and specify the path to your Maxmind DBs, eg:

          LoadPlugin="geoip2_city /home/user/apps/stats/GeoLite2-City.mmdb"
          ...
          LoadPlugin="geoip2_country /home/user/apps/stats/GeoLite2-Country.mmdb"
        1. Test it by running ~/apps/appname/awstats_cron and then check your stats.
          5 months later

          If you get an error in step 7, it's because there's a double quote missing from the end of line 11 in step 4. 🙂

            6 months later

            sean Did you guys switch to .log extension instead of .txt? I just opened log folders of couple of my apps and .txt files have 0B size, while now there are .log files and they contain data...

            I did change some apps (can't remember if they are the same ones) to PHP 8.1, could that be the reason?

            • sean replied to this.

              igor Yes, the system was changed to use ".log" for all web server logging. The change becomes effective for existing sites after any update to the site is saved.

              So .log extension is here to stay? I can update LOG="$LOGDIR/access.txt-$TODAY.gz" to access.log and not worry it will be changed again to txt?

              • sean replied to this.

                igor Correct, the extension won't be changing again.

                5 months later

                For those who aren't Vim users or fans (raising my hand), you can use the Nano editor (more user friendly IMO) to edit crontab (step 8) as follows:

                export VISUAL=nano; crontab -e

                If you've never used Nano before, use CTRL-O to save your changes and CTRL-X to exit Nano.

                Edit: The above command is only good for one command use. If you want nano to be the default editor for an entire SSH session use the following, courtesy of sean:

                EDITOR=nano crontab -e

                a year later

                sean I am trying to get GeoIP working as per these instructions. However, when I run ~/apps/appname/awstats_cron I get the error Can't locate Data/Validate/IP.pm in @INC and Compilation failed in require (path to)/awstats/wwwroot/cgi-bin/awstats.conf. Do I (or you) need to install the "data::Validate::IP" Pearl module? Or am I missing a important step?

                  nhughes You should be able to install the missing module with the following commands:

                  cd ~
                  curl -L https://cpanmin.us | perl - App::cpanminus
                  export PATH=$HOME/perl5/bin:$PATH
                  cpanm Data::Validate::IP
                  export PERL5LIB=$HOME/perl5/lib/perl5

                  If you see any other issues, please email support@opalstack.com so we can look at your setup specifically and troubleshoot further.

                  Mastodon