allinurl / goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
https://goaccess.io
MIT License
18.12k stars 1.1k forks source link

For Security,I want goaccess address bind in localhost(127.0.0.1),not bind in 0.0.0.0. #2157

Closed whatthehellisgoingon closed 3 years ago

whatthehellisgoingon commented 3 years ago

hi, @allinurl . I have been view those issues #1297 #1133 #1328 ,all of those goaccess address bind in 0.0.0.0,not bind in 127.0.0.1.how to make websocks connection works in nginx reverse proxy when goaccess address is binding in localhost(127.0.0.1)? wait for your response.

whatthehellisgoingon commented 3 years ago

when websocks connection in nginx https reverse proxy,please dont't set --ssl-cert=<path/cert.crt> and --ssl-key=<path/priv.key> in goaccess.conf or command line argument。otherwise it will show connection failed in chrome browser!!! following is nginx https reverse proxy conf

server {
listen 443 ssl;
....
location /goaccess_access {
            add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'" always;
            alias /var/www/html/goaccess/;
            index access_report.html;
        }
location /wss/ {
        proxy_pass http://127.0.0.1:7890;
        proxy_connect_timeout 5m;
        proxy_send_timeout 5m;
        proxy_read_timeout 5m;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Connection "keep-alive";
        proxy_pass_request_headers on;
        proxy_http_version 1.1;
    }
}

following is goaccess conf and command line argument

log-format COMBINED
html-report-title My Awesome Web Stats
daemonize true
pid-file /var/run/goaccess.pid
real-time-html true
db-path /var/www/html/goaccess/
persist true
restore true
goaccess -f /var/log/nginx/myexample.com.access.log  /var/log/nginx/access.log -o /var/www/html/goaccess/access_report.html --ws-url=wss://www.myexample.com:443/wss/ --addr=127.0.0.1
whatthehellisgoingon commented 3 years ago

i have solved by myself,thanks。

allinurl commented 3 years ago

Just for the record on this, you can always use --addr=<addr> and specify the IP address to bind server to.