目标:Kibana 5.5.1后面的nginx代理1.13(dockerized)
我要运行的麋鹿在码头工人,集装箱堆场。为了能够通过nginx代理访问ELK栈来绕过服务的各个端口。
的Kibana服务(默认端口5601)
http://<server>.com:5601
应该在以下地址到达:
http://<server>.com/kibana
问题:
的问题是,它不是在将server.basePath设置添加到配置后,可能会到达kibana站点。如果我将Kibana的每个base api调用添加到nginx配置(/ api,/ ui,...),我只能调出服务。
配置:
为Kibana的配置:
/opt/kibana/config/kibana.yml
具有如下条目:
server.host: "0.0.0.0"
server.basePath: "/kibana"
一切是默认
数独server.basePath
# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects # the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests # to Kibana. This setting cannot end in a slash.
nginx的配置:
location /kibana/ {
rewrite ^/kibana(/.*)$ $1 break;
proxy_pass http://<server>.com:5601/;
}
我使用sebp/elk:551泊坞窗图像及以下泊坞窗,撰写文件:
version: '2'
services:
elk:
image: sebp/elk:551
container_name: "elk"
volumes:
- /etc/kibana/config/kibana.yml:/opt/kibana/config/kibana.yml
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
environment:
SERVICE_5601_NAME: "kibana"
SERVICE_9200_NAME: "elasticsearch"
SERVICE_5044_NAME: "logstash"
restart: always
我曾尝试:
我已经尝试了与Kibana 4.6.1相同的设置,并且按预期完美工作。
版本,我已经测试并不起作用:5.4.3,5.1.2,5.0.2
我不想要什么:
我不想Kibana的每一个子目录中添加像/api, /ui, /app/kibana, ...
添加到代理配置。
还有其他解决方案或版本吗?
编辑1: @ whites11:浏览器从nginx返回502 Bad Gateway站点。 浏览器的相关信息:
一般
Request URL:http://<server-name>.com/kibana/
Request Method:GET
Status Code:502 Bad Gateway
Remote Address:<server-ip>:80
Referrer Policy:no-referrer-when-downgrade
响应头
Connection:keep-alive
Content-Length:575
Content-Type:text/html
Date:Thu, 24 Aug 2017 13:54:49 GMT
Server:nginx/1.13.3
请求头
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:<server-name>.com
Upgrade-Insecure-Requests:1
从nginx的
登录34#34: *8 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: <IP>, server: , request: "GET /kibana/ HTTP/1.1", upstream: "http://<server-ip>:5601/", host: "<server-name>.com"
究竟是什么意思“问题是,在将server.basePath设置添加到配置后无法到达kibana站点”?浏览器中究竟发生了什么? – whites11
@ whites11:我在帖子中增加了更多信息。 – neutron
第一件事就是''(我猜这是混淆)正确吗?如果进入kibana码头集装箱并运行'curl :5601',它是否正确响应? –
whites11