This is tutorial on how to run Go Access (a Visual Web Log Analyzer) behind an NGINX web server on Ubuntu 18.04.
Get Sudo Privilege
Before start we make sure that we will have no permission issue on the installation & configuration.
sudo su
NGINX Install & Config
Install Nginx from package manager
apt-get update
apt-get install nginx
after that, create a virtual host on the Nginx configuration
nano /etc/nginx/site-available/goaccess
copy & Paste this config:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream gwsocket {
server 127.0.0.1:7890;
}
server {
listen 8080;
# replace with your actual domain
server_name your.domain.com;
# if you chose a different location for the webroot, use it here
root /var/www/html;
location / {
try_files $uri =404;
}
location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://gwsocket;
proxy_buffering off;
proxy_read_timeout 7d;
}
}
note that this is a config for http, if you use https please look nginx guide to use ssl. And don’t forget yo change your.domain.com to your actual domain.
Create symbolic links from /sites-available
to /sites-enable
ln -s /etc/nginx/sites-available/goaccess /etc/nginx/sites-enable/
Check if there is some error in your configuration
nginx -t
If there is no error, then you can reload the nginx
service nginx reload
Go Access Install & Config
Install Go Access from the package manager
apt-get update
apt-get install goaccess
To configure the goaccess, first open the goaccess configuration file
nano /etc/goaccess.conf
From here, it is up to you to config the goaccess, but this is enough if you want to visualize nginx access log. You can uncomment these part:
time-format %H:%M:%S
date-format %d/%b/%Y
log-format COMBINED
daemonize true
real-time-html true
ws-url ws://your.domain.com:8080/ws
keep-db-files true
load-from-disk true
Don’t forget to change your.domain.com to your actual domain. exit and save.
After configure the config file, you can run goaccess by running this command to create a live report in /var/www/html/live-report.html
by refering to nginx access.log
file.
goaccess /var/log/nginx/access.log -a -o /var/www/html/live-report.html
Wait a couple of minutes until there is live-report.html
in /var/www/html/
Accessing Go Access Live Report
Now, Your live report should be generated and can be accessed in http://your.domain.com:8080/live-report.html