Kibana 仪表板无法与 Nginx 连接

Kibana dashboard couldn't connect with Nginx

您好,我正在尝试使用 Nginx 作为访问 Kibana 4 仪表板的反向代理。仪表板的位置在最新的 kibana 中不可用,但可以使用 URL.

访问。

Kibana 和 Nginx 运行ning 都在本地并安装在安装在 C:\

的 windows 机器上

Kibana 正在 运行localhost:5601 上线。 我安装了 NGinx 并将其配置为端口 80 上的 运行。我的 Nginx 配置文件如下所示。

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

    sendfile        on;
    server {
        listen       80;
        server_name  127.0.0.1:5601;


        location / {
            root   html;
            index  index.html index.htm;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       location ~ {
            proxy_pass  http://127.0.0.1:5601;
            #proxy_redirect https://kibana/;
        }
}

但是当我在浏览器中输入 localhost 时,我看到了,

"欢迎使用nginx!

如果您看到此页面,则 nginx 网络服务器已成功安装并正常运行。需要进一步配置。

有关联机文档和支持,请参阅 nginx.org。 nginx.com.

提供商业支持

感谢您使用 nginx。"

Kibana 可以正常工作:localhost:5601。 我还需要对 Kibana 配置文件进行任何更改吗?我想通过 localhost:80 通过 NGinx 访问 kibana 仪表板。

谢谢

将"server_name 127.0.0.1:5601;"更改为"server_name localhost:80;"

在 "server {" 上方添加此上游:

upstream kibana {
    server localhost:5601;
}

然后将 "location ~" 替换为 :

location /kibana/ {
    proxy_pass http://kibana/;
}

使用http://localhost/kibana访问Kibana

我已将我的 nginx 配置为反向代理 kibana-4 仪表板。以下 nginx 配置为我完成了这项工作:

    server {
    listen 80;

    #You can add your fqdn, say example.com, if you want to in the next parameter
    server_name localhost;

    auth_basic off;

    location / {
        proxy_pass http://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;        
    }
}

这里是如何使用 letencrypt 在远程服务器上通过 nginx kibana 和 ES 代理到 kibana

        server {
        listen [some_port] ssl http2;
        server_name [server_name];
        root /your/root/directoty;

        location /app {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/conf.d/yyyyyyyyy.passwd;
        proxy_pass http://example.com:5601;
       }


       location /bundles {
       proxy_pass  http://example.com:5601/bundles;
       }
       location /elasticsearch {
       proxy_pass [http://elasticsearch_server:9200;]
       }
       location /status {
       proxy_pass  http://example.com:5601/status;
       }
       location /api {
       proxy_pass  http://example.com:5601/api;
       }

       location /plugins {
       proxy_pass  http://example.com:5601/plugins;
       }


       location /ui {
       proxy_pass  http://example.com:5601/ui;
       }

       location /es_admin {
       proxy_pass  http://example.com:5601/es_admin;
       }

       location /built_assets {
         proxy_pass http://example.com:5601/built_assets;
       }

       location /node_modules {
         proxy_pass http://example.com:5601/node_modules;
       }

       location /translations {
         proxy_pass http://example.com:5601/translations;

       }

      location /internal {
        proxy_pass http://example.com:5601/internal;
      }   

     ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
     ssl_trusted_certificate /etc/letsencrypt/live/yourdomain.com/chain.pem;
     include snippets/ssl.conf;
     include snippets/letsencrypt.conf;

     access_log /var/log/nginx/xxxx.access.log;
     error_log /var/log/nginx/xxxxx.error.log;


     passenger_enabled on;
     passenger_min_instances 1;
     client_max_body_size 10m;

}