Setting up Netdata with an nginx reverse proxy

Ray DeMoss

Dabbler
Joined
Jul 11, 2017
Messages
11
I have an Nginx iocage jail setup for my webserver and is also used as a reverse proxy. It's currently running fine for 3 different jails, but I'm not having success setting this up for the Netdata service I have running on the FreeNAS host. I've been referencing this URL on the Netdata help site: https://docs.netdata.cloud/docs/running-behind-nginx/#intro. Has anyone else been able to this up?

My reverse proxy settings are in an include file called proxy.conf as noted below. I've tried many configurations and as outlined on the webpage above, but all have failed. Has anyone set this up successfully?

```
#Netdata

location ~ /netdata/(?<behost>.*)/(?<ndpath>.*) {
auth_basic "Administrators's Area";
auth_basic_user_file /root/.htpasswd;
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://backend-$behost/$ndpath$is_args$args;

gzip on;
gzip_proxied any;
gzip_types *;
}
```
The nginx.conf has this snippet in there to direct the netdata stream:

```
upstream backend-server {
server 192.168.1.96;
keepalive 64;
}
```
 
Top