How to configure Kibana 4 and elasticsearch for nginx?

I have kibana 4 and elasticsearch running on the same server.

I need to access kibana through a domain, but when I try, I keep getting a file that is not found.

I just create location / kibana in nginx and proxy_pass is ip: kibana port.
Has anyone had this?

+6
source share
4 answers

I fixed it as follows:

location /kibana4/ { proxy_pass http://host:5601/; proxy_redirect http://host:5601/ /kibana4/; } 

I had to use proxy_redirect to return the answer!

thanks

+2
source

This work for kibana 4.0.1. and I assume that you are running kibana on the same host as nginx, listening on port 5601.

Your nginx configuration should look like this:

 server { listen *:80 ; server_name server; access_log /var/log/nginx/kibana.srv-log-dev.log; error_log /var/log/nginx/kibana.srv-log-dev.error.log; location / { root /var/www/kibana; index index.html index.htm; } location ~ ^/kibana4/.* { proxy_pass http://kibana4host:5601; rewrite ^/kibana4/(.*) /$1 break; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd; } } 

Lines

 auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/kibana.myhost.org.htpasswd; 

can be used to provide basic authentication on the site.

The access link will be http: // server / kibana4

+15
source

don't just use location because it searches for the actual file after /

kibana4 is not a location, but an actual service

whenever you use proxy_pass you should use upstream braking with it

here is the working configuration with http basic auth and the completion of SSL

 upstream kibana { server 127.0.0.1:5601 fail_timeout=0; } server { listen 80; return 301 https://example.com; } server { listen *:443 ; ssl on; ssl_certificate /etc/nginx/ssl/all.crt; ssl_certificate_key /etc/nginx/ssl/server.key; server_name example.com; access_log /var/log/nginx/kibana.access.log; location / { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd; proxy_pass http://kibana; } } 
+6
source

this worked for me with Kibana 4.6.1:

 location ~ (/app/kibana|/bundles/|/kibana|/status|/plugins) { 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; rewrite /kibana/(.*)$ /$1 break; } 

(from here )

Not quite an elegant solution, but still ...

NB: server.basePath in the Kibana configuration should be set to "/" (or commented out altogether) in this case

+1
source

Source: https://habr.com/ru/post/983561/


All Articles