Nginx

無法將 Nginx 配置為另一台伺服器上彈性搜尋的反向代理

  • June 2, 2014

我正在嘗試在伺服器 A 上使用 Kibana 來訪問伺服器 B 上的彈性搜尋。

彈性搜尋受到伺服器 B 上的基本身份驗證的保護。

Kibana 也受到伺服器 A 上的基本身份驗證(和相同的密碼)的保護。

我正在使用這個配置(靈感來自這裡

我只是通過輸入以下地址來嘗試重定向,我收到錯誤 500:

在日誌中我有:

2014/06/01 16:45:55

$$ error $$3721#0:*1 重寫或內部重定向周期,同時內部重定向到“/es/_search”,客戶端:192.168.50.1,伺服器:A.com,請求:“GET /es/_search HTTP/1.1”,主機:“ A.com"

知道有什麼問題嗎?

#
# Nginx proxy for Elasticsearch + Kibana
#
# In this setup, we are password protecting the saving of dashboards. You may
# wish to extend the password protection to all paths.
#
# Even though these paths are being called as the result of an ajax request, the
# browser will prompt for a username/password on the first request
#
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
# http://FQDN:9200
#
server {
 listen                *:80 ;

 server_name           kibana.myhost.org;
 access_log            /var/log/nginx/kibana.myhost.org.access.log;

 location / {
   root  /usr/share/kibana3;
   index  index.html  index.htm;
 }

 location ~ ^/_aliases$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
 }
 location ~ ^/.*/_aliases$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
 }
 location ~ ^/_nodes$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
 }
 location ~ ^/.*/_search$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
 }
 location ~ ^/.*/_mapping {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
 }

 # Password protected end points
 location ~ ^/kibana-int/dashboard/.*$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
   limit_except GET {
     proxy_pass http://127.0.0.1:9200;
     auth_basic "Restricted";
     auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd;
   }
 }
 location ~ ^/kibana-int/temp.*$ {
   proxy_pass http://127.0.0.1:9200;
   proxy_read_timeout 90;
   limit_except GET {
     proxy_pass http://127.0.0.1:9200;
     auth_basic "Restricted";
     auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd;
   }
 }
}

引用自:https://serverfault.com/questions/601041