經常遇到需要把http配置成https的情況,但是在配置kibana的時候加上路徑可能會遇到困難,不加路徑沒有問題,這里說的是加路徑,因為kibana的跳轉路徑是他自己寫死的,例如登錄等,其實只需要nginx配置kibana一起配置即可。
1.nginx常規配置,配的443端口給到kibana
1 server { 2 listen 443 ssl; 3 #listen 10080; 4 server_name _; 5 #ssl on; 6 ssl_certificate /nginx/conf/ssl/server.crt; # 改成你的證書的名字 7 ssl_certificate_key /nginx/conf/ssl/server.key; # 你的證書的名字 8 ssl_verify_depth 1; 9 #charset koi8-r; 10 11 #access_log logs/host.access.log main; 12 error_page 404 403 500 502 503 504 /404.html; 13 14 location = /404.html { 15 root /nginx/html; 16 } 17 18 19 location /els { 20 proxy_pass http://192.168.0.184:5601; 21 } 22 }
這里配置了路徑為els,那么接下來我們需要去配置kibana所對應的配置
2.kibana對應的配置
1 # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. 2 # The default is 'localhost', which usually means remote machines will not be able to connect. 3 # To allow connections from remote users, set this parameter to a non-loopback address. 4 server.host: "192.168.0.184" 5 6 # Enables you to specify a path to mount Kibana at if you are running behind a proxy. 7 # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath 8 # from requests it receives, and to prevent a deprecation warning at startup. 9 # This setting cannot end in a slash. 10 server.basePath: "/els" 11 12 # Specifies whether Kibana should rewrite requests that are prefixed with 13 # `server.basePath` or require that they are rewritten by your reverse proxy. 14 # This setting was effectively always `false` before Kibana 6.3 and will 15 # default to `true` starting in Kibana 7.0. 16 server.rewriteBasePath: true
這里面重點是
1.server.basePath: "/els" 這個配置需要個nginx里面一致。
2.server.rewriteBasePath: true 這個配置需要打開
目前這個是我遇到nginx配置kibana的https遇到的問題。