Netdata Community

How to make NetData with reverse proxy

Hello. I wanted to ask, i have a domain, but it’s for jitsi meet server. I want that the netdata would be for the same domain but for example my jitsi meet domain is https://my-domain.org and i want that netdata would be for example: https://my-domain.org/netdata. On my server i’m using Nginx. Could you please tell me, what should i do, because now my NetData is not secure and it’s with servers IP adress. Waiting for your reply!

1 Like

Hi again, @_Gamer :grinning_face_with_smiling_eyes:

This looks like exactly what you need: Running Netdata behind Nginx | Learn Netdata

2 Likes

But i wanted to ask about it. Look, where you need to write server name so i need to write my working domain i mean https://my-domain.org and then write the location /netdata (or it can be another word not netdata in location) or i need to write in server name my new domain which doesn’t exist for example https://netdata.my-domain.org ? Because the situation is now that i have a main domain, and it’s for Jitsi Meet server. I don’t want to loose it, because now when i’m entering the domain i’m getting to the main page server. I want that it would be like a subfolder for my domain. Can you please a little bit guide me with these questions, where i asked? I’ve seen that article where you send me but i want a little information about it. Waiting for your reply @ilyam8

2 Likes

The title of the instructions ilyam8 linked is “As a subfolder to an existing virtual host”, which is what you asked for.

If you are having difficulty following the instructions, please be very specific in describing what you did and how it doesn’t do what you want.

nginx docs will be useful, especially the core and proxy modules.

3 Likes

I need more examples if it’s possible. Because as i said, i have a domain, but it’s for jitsi meet server but i want to add this domain to netdata too with /netdata. So it would be nice to have more examples of how to make a subfolder to an existing virtual host.

2 Likes

Ok, here’s another example. This is what I added to the server {} block of the virtual host.

    location ~ /net/data/(?<behost>.*)/(?<ndpath>.*) {
        access_log off;
        auth_basic "Authentication Required";
        auth_basic_user_file netdata-access;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_pass_request_headers on;
        proxy_set_header Connection "keep-alive";
        proxy_store off;
        proxy_pass http://netdata_backend_$behost/$ndpath$is_args$args;

        gzip on;
        gzip_proxied any;
        gzip_types *;
    }

    # make sure there is a trailing slash at the browser
    # or the URLs will be wrong
    location ~ /net/data/(?<behost>.*) {
        return 301 /net/data/$behost/;
    }

It’s very similar to the example already posted because that’s what I used as a guide. It’s a bit more complicated because within this subfolder there are subfolders, each corresponding to a host in the cluster.

This virtual host is only running HTTPS so I think it’s ok to use HTTP basic auth. But you should secure your vhost as you see fit.

Outside the server {} blocks there are a number of blocks like this, one for each host in the cluster that i can access via this host.

upstream netdata_backend_host1 }} {
    server host1_address:19999;
    keepalive 64;
}

upstream netdata_backend_host2 }} {
    server host2_address:19999;
    keepalive 64;
}

# ... and so on for each host's netdata server accessed via this virtual host
2 Likes

Hello! These lines in which file i should write? Can you wrote me the basic steps, where to create a new file if it’s neseccasry, which file to modify. Would be very helpful

1 Like

Sorry @_Gamer, I can’t. You might have more luck getting help to find your nginx config files from the nginx community or from Jitsi Meet server users or on Server Fault or something like that. I don’t know where they are on your system.

1 Like