$ yum install httpd-tools -y
$ mkdir -p /usr/local/nginx/conf/passwd $ htpasswd -c -b /usr/local/nginx/conf/passwd/kibana.passwd Userrenwolecom GN5SKorJ Adding password for user Userrenwolecom
在Nginx設定檔中新增以下內容(或新設定檔包含):
$ vim /usr/local/nginx/conf/nginx.conf server { listen 10.28.204.65:5601; auth_basic "Restricted Access"; auth_basic_user_file /usr/local/nginx/conf/passwd/kibana.passwd; location / { proxy_pass http://10.28.204.65: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; } }
取消下列註解:
$ vim /usr/local/kibana/config/kibana.yml server.host: "10.28.204.65"
$ systemctl restart kibana.service $ systemctl restart nginx.service
接下來瀏覽器造訪http://103.28.204.65:5601/ 會提示驗證彈窗,輸入以上產生的使用者密碼登入即可。
以上是怎麼透過Nginx反向代理實現kibana登入認證的詳細內容。更多資訊請關注PHP中文網其他相關文章!