Skip to content

goacces

Create a separate website that'll where you can serve the live report

.

Content of /etc/nginx/sites-available/goacess

server {
        listen 443;
        listen [::]:443;

        root /home/vector/goaccess;

        index index.html;

        server_name goaccess.vectorspace.xyz;

        location /      {
                auth_basic "Restricted Access";
                auth_basic_user_file /etc/nginx/.htpasswd;
                try_files $uri $uri/ =404;
        }

        ssl on;
        ssl_certificate /etc/letsencrypt/live/goaccess.vectorspace.xyz/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/goaccess.vectorspace.xyz/privkey.pem;
}

server {
        listen 0.0.0.0:80;
        server_name goaccess.vectorspace.xyz;
        rewrite ^ https://$host$request_uri? permanent;
}

Get the latest version, compile and install

wget https://tar.goaccess.io/goaccess-1.9.1.tar.gz
tar -xf goacces-1.9.1.tar.gz
cd goaccess-1.9.1
./configure --enable-utf8 --enable-geoip=mmdb --with-openssl --enable-debug
make
sudo make install

goacess.conf

Find goaccess.conf in unpacked directory. You can copy this file to some more appropriate location, the instruction i first followed copied it to /usr/local/etc/goaccess/goaccess.conf.

Anyway, point goaccess to the maxmind geoip database extracted earlier in the goaccess config:

1710933395.png

For GeoIP2 Country database:
# Download the GeoLite2-Country.madb. gz
# gunzip GeoLite2-Country. andb.gz
#
geoip-database /usr/local/etc/goaccess/GeoLite2-City.mndb
# Persistence Options

Final command

$ goaccess /var/log/nginx/access.log -o /home/vector/goaccess/report.html --real-time-html -p /home/vector/goaccess.conf --ssl-cert=fullchain.pem --ssl-key=privkey.pem

Note here that fullchain.pem and privkey.pem are for the domain which delivers goaccess report, which in my case is goaccess.vectorspace.xyz. They were generated using certbot earlier.


Comments