vozlt / nginx-module-vts

Nginx virtual host traffic status module
BSD 2-Clause "Simplified" License
3.23k stars 463 forks source link

Module bug #285

Open forolo opened 10 months ago

forolo commented 10 months ago

When i modify paramerters like paragraph title , preselect update intervale and CSS style I cannot obtain data poling of traffics status . What can i do that to resolve that issues

u5surf commented 10 months ago

@forolo Hi, Thanks reporting. To clarify what happened on your pages, let us tell the detail of your site's code.

Lecyd commented 10 months ago

(Debian Bullseye) When I modify status.template.html and copy it to nginx root folder nothing apear on status page (with Nginx vhost traffic status customization when it activated). Would you like to explain to us step by step with détails the status customization : -Change update intervale from 1sec to 8sec or 10sec. -modify CSS style

u5surf commented 10 months ago

When I modify status.template.html and copy it to nginx root folder nothing apear on status page (with Nginx vhost traffic status customization when it activated).

@Lecyd Have you customized the template.html following the page below? https://github.com/vozlt/nginx-module-vts#to-customize-after-the-module-installed

u5surf commented 10 months ago

@Lecyd Can you customized the template.html and nginx.conf following that.

vtsStatusURI is the endpoint of fetching the vts data by the json format.

The below example refers that the endpoint is prepared by location /status on nginx.conf.

https://github.com/vozlt/nginx-module-vts/blob/bd338835463811fe0221db858d865269952aaed9/share/status.template.html#L821-L832

share/status.template.html (Change update intervale from 1sec to 8sec)

diff --git a/share/status.template.html b/share/status.template.html
index 68f771a..89c2b98 100644
--- a/share/status.template.html
+++ b/share/status.template.html
@@ -386,7 +386,7 @@
                 });
             };

-            var vtsStatusURI = "{{uri}}/format/json", vtsUpdateInterval = 1000, vtsUpdate;
+            var vtsStatusURI = "http://{{yourhostname}}:8081/status", vtsUpdateInterval = 8000, vtsUpdate;

             var vtsStatusVars = {
                 titles: {

nginx.conf

http {
    include mime.types;
    default_type application/octet-stream;

    vhost_traffic_status_zone shared:vhost_traffic_status:32m;
    vhost_traffic_status_zone;

    upstream backend {
        zone backend 64k;
        server localhost:8080;
    }
    server {
        root /usr/local/nginx/html;
        listen 8081;
        location /backend {
            proxy_pass http://backend;
        }
        location / {
                return 301 /status.html;
        }
        location /status.html {}
        location /status {
            vhost_traffic_status_display;
            vhost_traffic_status_display_format json;

            access_log /usr/local/nginx/logs/access.log;
        }
    }