I suspect this is a problem stemming from my own inexperience with nginx but i followed the steps in Running Netdata behind Nginx | Learn Netdata about running netdata in a subfolder behind an existing host but i keep getting errors like this in developer console
or this
my nginx configuration file for netdata is stored in /etc/nginx/sites-available/DOMAIN and is this:
upstream netdata {
server 127.0.0.1:19999;
keepalive 64;
}
server {
listen 80;
# uncomment the line if you want nginx to listen on IPv6 address
#listen [::]:80;
# the virtual host name of this subfolder should be exposed
#server_name netdata.example.com;
location = /netdata {
return 301 /netdata/;
}
location ~ /netdata/(?<ndpath>.*) {
proxy_redirect off;
proxy_set_header Host $host;
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/$ndpath$is_args$args;
gzip on;
gzip_proxied any;
gzip_types *;
}
}
I will be testing this out in a bit. Though I did try your location configuration on my DOMAIN sites-available config which led me to a 404 page which makes me think I did something wrong in the initial setup.
So after completely reinstalling nginx and resetting all its configs to default and basically copy pasting the nginx conf you provided. It finally worked.
Now to test slowly.
Update:
After using certbot to install the ssl certificate. It then returned a 404 error.
I don’t exactly know how nginx does ssl certificates but this code only seems to work on one server block and cannot work on the rest.
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
Unfortunately, this does make it so that the server block without this will 404 for some reason.
I do not know how this works, but for now i have disabled https to make things work