Installing kibana with nginx proxy. Centos 8.

Let’s consider one of the examples of installing the Kibana component, which is responsible for rendering in Elasticsearch.

Install kibana:
sudo yum install kibana -y

Open the settings file and edit lines:
sudo vi /etc/kibana/kibana.yml

server.port: 5601
... "localhost"
server.basePath: "/elk7int"

Dont start Kibana now

Install nginx
yum install nginx -y
If you see error: nginx not found, run “yum install epel-release -y” and run install nginx.

Set login “elk7int” and password for nginx access:
echo "elk7int:`openssl passwd -apr1`" | sudo tee -a /etc/nginx/htpasswd.users

Open nginx config file:
vi /etc/nginx/nginx.conf
Disable IPv6 if you don’t use it, comment line “listen [::]:80…”. And paste new section “location /elk7int” in nginx config:

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
#       listen       [::]:80 default_server;
        server_name  elk7int;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location /elk7int {
        auth_basic "Restricted Access";
        auth_basic_user_file /etc/nginx/htpasswd.users;
        rewrite ^/elk7int/(.*) /$1 break;
        proxy_ignore_client_abort on;
        proxy_pass http://localhost:5601/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;

        location / {

        error_page 404 /404.html;
            location = /40x.html {

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {

if you want to completely close access to the entire server, move the two lines that starts with “auth_basic” above “location /elk7int”

Set connection settings for nginx
sudo setsebool httpd_can_network_connect 1 -P

Open firewall for nginx access:
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload

Start nginx and kibana
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start kibana
sudo systemctl enable kibana

Open kibana in browser: http://[yourserver.ip]/elk7int

Leave a Reply