This is tutorial on how to run Go Access (a Visual Web Log Analyzer) behind an NGINX web server on Ubuntu 18.04.
Make sure you have sudo privilege so there are no permission problem when run these command bellow
sudo su
apt-get update
apt-get install nginx
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.
ln -s /etc/nginx/site-available/goaccess /etc/nginx/site-enable/
service nginx reload
apt-get update
apt-get install goaccess
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.
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/
Your html should be in http://your.domain.com:8080/live-report.html