Proxy setup for kibana using nginx

I am trying to setup a proxy for Kibana. All required services are running for me.
I have the following configuration file under /etc/nginx/sites-available

server {
    listen 80;

    server_name testkibana;

   auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
        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;
    }
}

I have already tried removing authorisation as below :

server {
    listen 80;

    server_name testkibana;

   auth_basic "off";

    location / {
        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;
    }
}

I am trying to access kibana through testkibana, but I get below page
Screenshot from 2023-07-02 23-11-17

What am I doing wrong here ?

This looks like a Nginx issue, not a Kibana issue, you will probably find a solution looking for similar Nginx issues on StackOverflow for example.

Are Nginx and Kibana on the same server? What does your kibana.yml looks like?

But, why use Nginx in front of Kibana to have authentication?

Thanks for you response. It certainly looks like a nginx issue. I have tried some answers found on stackoverflow, but none seem to work.

That is why I have removed authentication using auth_basic "off";

Below is my Kibana.yml :

1 # Kibana is served by a back end server. This setting specifies the port to use.
  2 server.port: 5601
  3 
  4 # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
  5 # The default is 'localhost', which usually means remote machines will not be able to connect.
  6 # To allow connections from remote users, set this parameter to a non-loopback address.
  7 server.host: "localhost"
  8 
  9 # Enables you to specify a path to mount Kibana at if you are running behind a proxy.
 10 # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
 11 # from requests it receives, and to prevent a deprecation warning at startup.
 12 # This setting cannot end in a slash.
 13 #server.basePath: ""
 14 
 15 # Specifies whether Kibana should rewrite requests that are prefixed with
 16 # `server.basePath` or require that they are rewritten by your reverse proxy.
 17 # This setting was effectively always `false` before Kibana 6.3 and will
 18 # default to `true` starting in Kibana 7.0.
 19 #server.rewriteBasePath: false
 20 
 21 # Specifies the public URL at which Kibana is available for end users. If
 22 # `server.basePath` is configured this URL should end with the same basePath.
 23 #server.publicBaseUrl: ""
 24 
 25 # The maximum payload size in bytes for incoming server requests.
 26 #server.maxPayload: 1048576
 27 
 28 # The Kibana server's name.  This is used for display purposes.
 29 #server.name: "your-hostname"
 30 
 31 # The URLs of the Elasticsearch instances to use for all your queries.
 32 elasticsearch.hosts: ["http://localhost:9200"]
 33 
 34 # Kibana uses an index in Elasticsearch to store saved searches, visualizations and
 35 # dashboards. Kibana creates a new index if the index doesn't already exist.
 36 #kibana.index: ".kibana"
 37 
 38 # The default application to load.
 39 #kibana.defaultAppId: "home"
 40 
 41 # If your Elasticsearch is protected with basic authentication, these settings provide
 42 # the username and password that the Kibana server uses to perform maintenance on the Kibana
 43 # index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
 44 # is proxied through the Kibana server.
 45 #elasticsearch.username: "kibana_system"
 46 #elasticsearch.password: "pass"
 47 
 48 # Kibana can also authenticate to Elasticsearch via "service account tokens".
 49 # If may use this token instead of a username/password.
 50 # elasticsearch.serviceAccountToken: "my_token"
 51 
 52 # Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
 53 # These settings enable SSL for outgoing requests from the Kibana server to the browser.
 54 #server.ssl.enabled: false
55 #server.ssl.certificate: /path/to/your/server.crt
 56 #server.ssl.key: /path/to/your/server.key
 57 
 58 # Optional settings that provide the paths to the PEM-format SSL certificate and key files.
 59 # These files are used to verify the identity of Kibana to Elasticsearch and are required when
 60 # xpack.security.http.ssl.client_authentication in Elasticsearch is set to required.
 61 #elasticsearch.ssl.certificate: /path/to/your/client.crt
 62 #elasticsearch.ssl.key: /path/to/your/client.key
 63 
 64 # Optional setting that enables you to specify a path to the PEM file for the certificate
 65 # authority for your Elasticsearch instance.
 66 #elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]
 67 
 68 # To disregard the validity of SSL certificates, change this setting's value to 'none'.
 69 #elasticsearch.ssl.verificationMode: full
 70 
 71 # Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
 72 # the elasticsearch.requestTimeout setting.
 73 #elasticsearch.pingTimeout: 1500
 74 
 75 # Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
 76 # must be a positive integer.
 77 #elasticsearch.requestTimeout: 30000
 78 
 79 # List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
 80 # headers, set this value to [] (an empty list).
 81 #elasticsearch.requestHeadersWhitelist: [ authorization ]
 82 
 83 # Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
 84 # by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
 85 #elasticsearch.customHeaders: {}
 86 
 87 # Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
 88 #elasticsearch.shardTimeout: 30000
 89 
 90 # Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
 91 #elasticsearch.logQueries: false
 92 
 93 # Specifies the path where Kibana creates the process ID file.
 94 #pid.file: /run/kibana/kibana.pid
95 
 96 # Enables you to specify a file where Kibana stores log output.
 97 #logging.dest: stdout
 98 
 99 # Set the value of this setting to true to suppress all logging output.
100 #logging.silent: false
101 
102 # Set the value of this setting to true to suppress all logging output other than error messages.
103 #logging.quiet: false
104 
105 # Set the value of this setting to true to log all events, including system usage information
106 # and all requests.
107 #logging.verbose: false
108 
109 # Set the interval in milliseconds to sample system and process performance
110 # metrics. Minimum is 100ms. Defaults to 5000.
111 #ops.interval: 5000
112 
113 # Specifies locale to be used for all localizable strings, dates and number formats.
114 # Supported languages are the following: English - en , by default , Chinese - zh-CN .
115 #i18n.locale: "en"

Kibana 6.3 is EOL and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

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