From 55e6c6d2150fca97272cff6e874a8e3d8b8cd000 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Tue, 10 May 2022 09:30:51 +0200 Subject: Try different setup for the goaccess websocket --- playbooks.d/webserver-nginx/share/goaccess.service | 2 +- playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil | 7 +++++++ playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil.www | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'playbooks.d/webserver-nginx') diff --git a/playbooks.d/webserver-nginx/share/goaccess.service b/playbooks.d/webserver-nginx/share/goaccess.service index 2474991..d278145 100644 --- a/playbooks.d/webserver-nginx/share/goaccess.service +++ b/playbooks.d/webserver-nginx/share/goaccess.service @@ -13,7 +13,7 @@ PermissionsStartOnly=true ExecStartPre=mkdir -p -- /run/goaccess ExecStartPre=chown -- www-data:www-data /run/goaccess ExecStartPre=chmod -- 0740 /run/goaccess -ExecStart = sh -c "goaccess -a -f /var/log/nginx/access/%i/* -o /run/goaccess/%i.html --real-time-html --ws-url %i" +ExecStart = sh -c "goaccess -a -f /var/log/nginx/access/%i/* -o /run/goaccess/%i.html --real-time-html --ws-url wss://%i:443/goaccess-ws --socket 7890" [Install] WantedBy = multi-user.target diff --git a/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil b/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil index f80c4b6..0551c3a 100644 --- a/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil +++ b/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil @@ -18,6 +18,13 @@ server { try_files $1 =404; } + location /goaccess-ws { + proxy_pass http://localhost:7890; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } + location / { return 301 https://www.tyil.nl$request_uri; } diff --git a/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil.www b/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil.www index f0c8aeb..e9fa693 100644 --- a/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil.www +++ b/playbooks.d/webserver-nginx/share/sites.d/https/nl.tyil.www @@ -24,7 +24,7 @@ server { # GoAccess location /analytics { - add_header Content-Security-Policy "default-src 'self'; script-src 'unsafe-inline' 'unsafe-eval'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src wss://tyil.nl:7890" + add_header Content-Security-Policy "default-src 'self'; script-src 'unsafe-inline' 'unsafe-eval'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src wss://tyil.nl:443" alias /run/goaccess; try_files /tyil.nl.html =404; -- cgit v1.1