【问题标题】:Kibana 5.0 apache proxy and reverse-proxy configuration failsKibana 5.0 apache 代理和反向代理配置失败
【发布时间】:2017-04-06 08:29:36
【问题描述】:

我正在尝试设置一个基本的反向代理来访问我的 kibana 实例。 这里是kibana实例(直接通过:5601工作没有任何问题)

#server.basePath: ""
server.basePath:"/kibana"

还有我的 apache 东西

<VirtualHost *:80>
    Servername xxxx
    ProxyPreserveHost On
    ProxyRequests On
    ProxyPass / http://localhost:5601
    ProxyPassReverse / http://localhost:5601
</VirtualHost>

问题是我明白了 http://xxxx/

代理错误

代理服务器收到来自上游服务器的无效响应。 代理服务器无法处理请求 GET /app/kibana。

原因:DNS 查找失败:localhost:5601app

我做了一些测试,但似乎没有任何效果。 第二次尝试 代理通行证/http://localhost:5601/app/kibana ProxyPassReverse / http://localhost:5601/app/kibana

这次好多了,但还是不行 http://xxxx 我眨了眨眼,可以看到“kibana 正在加载”,然后是一条大红色消息

Kibana 未正确加载。检查服务器输出以获取更多信息 信息。

【问题讨论】:

    标签: apache proxy reverse-proxy kibana-5


    【解决方案1】:

    好的,这很容易...... apache conf 是(注意斜线)

    <VirtualHost *:80>
        Servername xxxx
        ProxyPreserveHost On
        ProxyRequests On
        ProxyPass / http://localhost:5601/
        ProxyPassReverse / http://localhost:5601/
    </VirtualHost>
    

    我让所有默认情况下都在 Kibana 上(没有 base.path)

    【讨论】:

    • "ProxyRequests" 应该设置为 "Off" 否则你只是错误地配置了一个开放的代理。我正在编辑此内容,以便如果有人逐字剪切并粘贴此内容,他们不会将另一个不安全的开放代理添加到互联网。
    【解决方案2】:

    试试这样的

    <VirtualHost *:8190>
        Servername kibana
    
        DirectoryIndex /app/kibana
    
        ProxyPass /app/kibana http://kibana:5601/app/kibana
        ProxyPassReverse /app/kibana http://kibana:5601/app/kibana
    
        ProxyPass /app/timelion http://kibana:5601/app/timelion
        ProxyPassReverse /app/timelion http://kibana:5601/app/timelion
    
        ProxyPass /bundles http://kibana:5601/bundles
        ProxyPassReverse /bundles http://kibana:5601/bundles
    
        ProxyPass /elasticsearch http://kibana:5601/elasticsearch
        ProxyPassReverse /elasticsearch http://kibana:5601/elasticsearch
    
        ProxyPass /status http://kibana:5601/status
        ProxyPassReverse /status http://kibana:/status
    
        ProxyPass /api/status http://kibana:5601/api/status
        ProxyPassReverse /api/status http://kibana:5601/api/status
    
        ProxyPass /api/console http://kibana:5601/api/console
        ProxyPassReverse /api/console http://kibana:5601/api/console
    
        ProxyPass /api/timelion/run http://kibana:5601/api/timelion/run
        ProxyPassReverse /api/timelion/run http://kibana:5601/api/timelion/run
    
        ProxyPass /api/timelion/functions http://kibana:5601/api/timelion/functions
        ProxyPassReverse /api/timelion/functions http://kibana:5601/api/timelion/functions
    
        ProxyPass /api/ http://kibana:5601/api/
        ProxyPassReverse /api/ http://kibana:5601/api/
    
        ProxyPass /goto/ http://kibana:5601/goto/
        ProxyPassReverse /goto/ http://kibana:5601/goto/
    
        ProxyPass /shorten http://kibana:5601/shorten
        ProxyPassReverse /shorten http://kibana:5601/shorten
    
        ProxyPass /plugins/kibana/ http://kibana:5601/plugins/kibana/
        ProxyPassReverse /plugins/kibana/ http://kibana:5601/plugins/kibana/
    
        ProxyPass /plugins/timelion/ http://kibana:5601/plugins/timelion/
        ProxyPassReverse /plugins/timelion/ http://kibana:5601/plugins/timelion/
    
        ProxyPass /app/sense http://kibana:5601/app/sense
        ProxyPassReverse /app/sense http://kibana:5601/app/sense
    
        ProxyPass /ui/fonts/open_sans/ http://kibana:5601/ui/fonts/open_sans/
        ProxyPassReverse /ui/fonts/open_sans/ http://kibana:5601/ui/fonts/open_sans/
    
        ProxyPass /es_admin/ http://kibana:5601/es_admin/
        ProxyPassReverse /es_admin/ http://kibana:5601/es_admin/
    
        ErrorLog "logs/kibana-error.log"
    
    </VirtualHost>
    

    Kibana 4 还不到一半 :)

    【讨论】:

    • 在下面提出了一个稍微改进的答案。对我来说,如果没有 /plugins 代理规则,它将无法工作。谢谢! hj
    【解决方案3】:

    在 Kibana 6.5.4 上,Sergiu Indrie 的回答略有不同(感谢您的回答)。对我来说,如果没有插件部分,它将无法工作。

        ProxyRequests On
    
        ProxyPass /KIB/app/kibana http://127.0.0.1:5601/app/kibana
        ProxyPassReverse /KIB/app/kibana http://127.0.0.1:5601/app/kibana
    
        ProxyPass /KIB/app/timelion http://127.0.0.1:5601/app/timelion
        ProxyPassReverse /KIB/app/timelion http://127.0.0.1:5601/app/timelion
        ProxyPass /KIB/bundles http://127.0.0.1:5601/bundles
        ProxyPassReverse /KIB/bundles http://127.0.0.1:5601/bundles
        ProxyPass /KIB/plugins http://127.0.0.1:5601/plugins
        ProxyPassReverse /KIB/plugins http://127.0.0.1:5601/plugins
        ProxyPass /KIB/elasticsearch http://127.0.0.1:5601/elasticsearch
        ProxyPassReverse /KIB/elasticsearch http://127.0.0.1:5601/elasticsearch
        ProxyPass /KIB/status http://127.0.0.1:5601/status
        ProxyPassReverse /KIB/status http://127.0.0.1:5601/status
        ProxyPass /KIB/api http://127.0.0.1:5601/api
        ProxyPassReverse /KIB/api http://127.0.0.1:5601/api
        ProxyPass /KIB/goto http://127.0.0.1:5601/goto
        ProxyPassReverse /KIB/goto http://127.0.0.1:5601/goto
        ProxyPass /KIB/shorten http://127.0.0.1:5601/shorten
        ProxyPassReverse /KIB/shorten http://127.0.0.1:5601/shorten
    
        <Directory /KIB/app/kibana/>
            Require all granted
        </Directory>
    

    【讨论】:

      【解决方案4】:

      我在 Apache/2.4.10 上使用这个更紧凑的虚拟主机配置:

      <Location "/">
          Require all granted
      
          ProxyPass "http://127.0.0.1:5601/" keepalive=On
          ProxyPassReverse "http://127.0.0.1:5601/"
          #LogLevel alert trace5
      </Location>
      

      【讨论】:

        【解决方案5】:

        nano /etc/apache2/sites-available/kibana-vhost.conf

        <VirtualHost *:80>
            Servername xxxx.name.xyz
            ProxyPreserveHost On
            ProxyRequests On
            ProxyPass / http://localhost:5601/
            ProxyPassReverse /(.*) http://localhost:5601/(.*)
        </VirtualHost>
        

        谢谢,

        这对我有用...

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-04-26
          • 2017-10-24
          • 2018-02-14
          • 1970-01-01
          • 1970-01-01
          • 2014-09-07
          • 2017-08-16
          • 1970-01-01
          相关资源
          最近更新 更多