amazon-web-services - 无法将 AWS Kibana 代理传递给 nginx

标签 amazon-web-services nginx kibana-4

我正在使用 AWS kibana 搜索和查看 Logstash 已编入索引的日志。现在我使用的是来自 AWS 的默认 URL,并且仅限于我的 IP 地址。我需要通过 nginx 代理通过它,我尝试按照此文档进行操作:https://sysadmins.co.za/aws-access-kibana-5-behind-elb-via-nginx-reverse-proxy-on-custom-dns/

但是 kibana 没有加载。我收到以下错误:

Kibana: Not Found
Error: Not Found
    at respond (http://IP/index.js?_b=7562:85344:15)
    at checkRespForFailure (http://IP/index.js?_b=7562:85312:7)
    at http://IP/index.js?_b=7562:83950:7
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at wrappedErrback (http://IP/index.js?_b=7562:20902:78)
    at http://IP/index.js?_b=7562:21035:76
    at Scope.$eval (http://IP/index.js?_b=7562:22022:28)
    at Scope.$digest (http://IP/index.js?_b=7562:21834:31)
    at Scope.$apply (http://IP/index.js?_b=7562:22126:24)

添加 Nignx 配置:
    server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
      server_name kibana.mydomain.com;

      # for elb health checks
      location /status {
        root /usr/share/nginx/html/ ;
      }

      location / {
        proxy_set_header Host search-aws-es.eu-west-1.es.amazonaws.com;
        proxy_set_header X-Real-IP <public-ip-for-instance>;

        proxy_http_version 1.1;
        proxy_set_header Connection "Keep-Alive";
        proxy_set_header Proxy-Connection "Keep-Alive";
        proxy_set_header Authorization "";

        proxy_pass https://search-aws-es.eu-west-1.es.amazonaws.com/_plugin/kibana/;
        proxy_redirect https://search-aws-es.eu-west-1.es.amazonaws.com/_plugin/kibana/ http://<public-ip-for-instance>/kibana/;
      }

      location ~ (/app/kibana|/app/timelion|/bundles|/es_admin|/plugins|/api|/ui|/elasticsearch) {
         proxy_pass              http://search-aws-es.eu-west-1.es.amazonaws.com;
         proxy_set_header        Host $host;
         proxy_set_header        X-Real-IP $remote_addr;
         proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header        X-Forwarded-Proto $scheme;
         proxy_set_header        X-Forwarded-Host $http_host;
    }
  }
}

最佳答案

在您的最后一个位置块上,添加/_plugin/kibana,它为我修复了它。

我的工作设置(使用基于 VPC 的 ES,但只要您在 ES 访问策略中授权代理的 IP,就不会有太大变化):

server {
  listen       80;
  server_name  kibana.mydomain.com

  location / {
    proxy_http_version 1.1;
    # proxy_set_header Host https://asdfadsfasdfasdf.regionxxx.es.amazonaws.com;
    proxy_set_header Connection "Keep-Alive";
    proxy_set_header Proxy-Connection "Keep-Alive";
    proxy_set_header Authorization "";
    proxy_pass              https://asdfadsfasdfasdf.regionxxx.es.amazonaws.com/_plugin/kibana/;
  }

  location ~ (/_plugin/kibana|/app/kibana|/app/timelion|/bundles|/es_admin|/plugins|/api|/ui|/elasticsearch) {
    proxy_pass              https://asdfadsfasdfasdf.regionxxx.es.amazonaws.com;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_set_header        X-Forwarded-Host $http_host;
    proxy_set_header        Authorization  "";
  }
}

关于amazon-web-services - 无法将 AWS Kibana 代理传递给 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46240924/

相关文章:

amazon-web-services - 如何处理 AWS 中包含凭证的配置文件?

我的 AWS 基础设施上的 MongoDB 还是 AWS 上的 DynamoDB 包?

nginx - Flask 和 nginx 路由

elasticsearch - 如何在 kibana 中使用带有 key 和 token 的 tilemap

amazon-web-services - 错误 aws_alb_target_group 设置了 "count",必须在特定实例上访问其属性

api - 是否可以使用 aws api 网关进行相互身份验证?

python - Docker Nginx 不监听浏览器

php - Nginx - wordpress 在子目录下,应该传递什么数据?

java - 我可以在 Kibana 中更改可视化的索引模式吗?

elasticsearch - 合并名称相同且不区分大小写的存储桶