Skip to content

Instantly share code, notes, and snippets.

@muhammadardie
Created January 7, 2025 07:42
Show Gist options
  • Save muhammadardie/6fb803490126205ef37bedd9589b3a16 to your computer and use it in GitHub Desktop.
Save muhammadardie/6fb803490126205ef37bedd9589b3a16 to your computer and use it in GitHub Desktop.
GoAccess configuration using supervisord and nginx (Rocky Linux 9)
[program:goaccess]
command=/usr/bin/goaccess /var/log/nginx/access.log -o /var/www/goaccess/index.html --log-format=COMBINED --real-time-html --tz=Asia/Jakarta --ws-url=wss://subdomain.example.com:443/wss --port 7890
directory=/var/www/goaccess
environment=HOME="/root",USER="root"
autostart=true
autorestart=true
startretries=3
user=root
redirect_stderr=true
stdout_logfile=/var/log/supervisor/goaccess.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
server {
listen 80;
server_name subdomain.example.com;
# Redirect all HTTP requests to HTTPS
return 301 https://subdomain.example.com$request_uri;
}
server {
listen 443 ssl;
server_name subdomain.example.com;
root /var/www/goaccess;
# SSL Configuration
ssl_certificate /etc/letsencrypt/live/subdomain.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
root /var/www/goaccess;
index index.html;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location /ws {
proxy_pass http://localhost:7890;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment