Kibana 7.12 nginx reverse proxy, docker compose

Hi Im trying to use nginx as a reverse proxy for kibana but I can make it work, this is my kibana.yml

server.name: kibana
server.host: "localhost"
elasticsearch.hosts: [ "https://elasticsearch:9200" ]
elasticsearch.username: kibana
elasticsearch.password: mypassword
server.ssl.enabled: true
server.ssl.certificate: /usr/share/kibana/newfile.crt.pem
server.ssl.key: /usr/share/kibana/newfile.key.pem
elasticsearch.ssl.verificationMode: none
xpack.encryptedSavedObjects.encryptionKey: "myencriptionkey"
server.publicBaseUrl: "https://127.0.0.1:9977"
server.basePath: "/kibana"
server.rewriteBasePath: true

this is the docker compose file

  kibana:
    image: docker.elastic.co/kibana/kibana:7.12.0
    volumes:
    - ./config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro
    - ./certificates/newfile.crt.pem:/usr/share/kibana/newfile.crt.pem
    - ./certificates/newfile.key.pem:/usr/share/kibana/newfile.key.pem
    ports:
    - "5601:5601"
    links:
    - elasticsearch
    container_name: kibana

  nginx:
    image: nginx
    ports:
    - "6601:6601"
    volumes:
    - ./nginx/:/etc/nginx/conf.d/
    - ./nginx/:/var/log/nginx
    links:
    - kibana

and this is my default.conf for nginx

server {
    listen 6601;
    include /etc/nginx/default.d/*.conf;
    location /kibana/ {

        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;
    }
}

this is one of the errors that im getting:

2021/04/21 00:39:04 [error] 22#22: *1 no live upstreams while connecting to upstream, client: 172.21.101.254, server: , request: "GET /kibana/ HTTP/1.1", upstream: "http://localhost/kibana/", host: "172.21.101.21:6601

what Im doing wrong?

This is wrong, it means that you want to pass the requests you are receiving in the nginx container on the port 6601 to the same container in the port 5601, localhost always means the same host.

You should try to set it to http://kibana:5601.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.