GregYankovoy / docker-goaccess

goaccess reverse proxied through nginx for ease of use
MIT License
32 stars 14 forks source link

redirect the output to a subdomain #15

Closed Habak1 closed 2 years ago

Habak1 commented 3 years ago

Hello @GregYankovoy , thanks a lot for this cool project! it works absolutely fine. With http://ipadress:7889 I get access to the real-time-html and a green light next to the gear on the goaccess page. Perfect so far. But when I redirect a subdomain for example "goaccess.mydomain.com" to http://ipadress:7889 then I get the error message: WebSocket connection to 'wss://goaccess.mydomain.com/' failed. There applies: "GoAccess content to be viewed without any other setup", so I have no chance to change anything, using the config-file. Do you have an idea how to solve this?

And another note is that it would be great to be able to run the container with different ports. Background is that I want to display multiple web sites individually.

In any case, thanks again for the great Docker image. Thanks in advance for your help.

GregYankovoy commented 3 years ago

Hi @Habak1. How is the subdomain pointed to the container? You'll want to make sure it's using at least HTTP 1.1 and allows for connection upgrades for websockets. There's an example available in the readme for nginx.

location ^~ /goaccess {
    resolver 127.0.0.11 valid=30s;
    set $upstream_goaccess goaccess;
    proxy_pass http://$upstream_goaccess:7889/;

    proxy_connect_timeout 1d;
    proxy_send_timeout 1d;
    proxy_read_timeout 1d;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
}

In regards to the different ports, I believe you want to run multiple instances of his container on different ports? This should be possible through native docker arguments. The README provides a sample command to map TCP port 7889 to the container port of 7889. This can be changed to suit your needs. For instance, you can use the below to expose the container on port 8080 of the host: docker run --name goaccess -p 8080:7889 -v /path/to/host/nginx/logs:/opt/log -v /path/to/goaccess/storage:/config -d gregyankovoy/goaccess

Habak1 commented 3 years ago

Thank you very much for the tips. I will try the days to understand and implement it and then report back.

Habak1 commented 2 years ago

Hi Greg, thank you very much for the hints. Now everything works fine.