首页 > 解决方案 > 由于静态文件加载失败,无法从浏览器访问 grafana

问题描述

我想从我的浏览器访问 grafana 并使其公开可用。但是,我收到以下错误:

If you're seeing this Grafana has failed to load its application files 

1. This could be caused by your reverse proxy settings.

2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath

3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build

4. Sometimes restarting grafana-server can help

grafana我尝试解决一些问题并在's 设置中添加了域名。根据文档,我的 NGINX 非常完美。事实上,一切都运行良好。问题出在匿名会话中,如果我尝试在无用户模式下加载它,它不会加载。在登录模式下,它会加载但没有我创建的所有仪表板。

我的 NGINX 配置如下:

proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=grafana_cache:10m max_size=20g
                 inactive=60m use_temp_path=off;

server {

        server_name foo.bar www.foo.bar;

        location / {
                proxy_cache grafana_cache;
                proxy_pass http://127.0.0.1:3000;
                include /etc/nginx/proxy_params;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/foo.bar/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/foo.bar/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


}


server {
    if ($host = www.foo.bar) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = foo.bar) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        listen [::]:80;

        server_name foo.bar www.foo.bar;
    return 404; # managed by Certbot




}

我希望grafana仪表板在用户登录和不登录的情况下都能正常工作。

标签: nginxamazon-ec2grafana

解决方案


我将我的hash_bucket_size设置删除为 64nginx.conf并使其正常工作。


推荐阅读