kibana通過nginx新增賬號密碼驗證
參考連線:https://www.cnblogs.com/configure/p/7607302.html
自行開啟伺服器:5601埠或關閉防火牆,具體命令百度吧
1. kibana自身是沒有安全驗證的,所以賬號密碼的驗證通過nginx實現
2. 實現過程
2.1 安裝nginx:yum -y install nginx
不知道為什麼,很多參考資料說yum安裝的啟動命令預設路徑在:/usr/local/nginx/sbin
我的是:啟動命令路徑:/usr/sbin/nginx 暗轉路徑是:/etc/nginx
配置檔案地址:/etc/nginx/conf.d/nginx.conf (可以有選擇,啟動的時候手動指定,不指定的話,預設先載入/etc/nginx/default.d目錄下的*.conf,在載入conf.d目錄下的*.conf,推薦寫在default.d 目錄下)
如果用nginx預設的配置檔案,注意修改載入配置檔案的屬性。
我的配置檔案(最簡化的):
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ events { worker_connections 1024; } http { # log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; # access_log /var/log/nginx/access.log main; server { listen 5601; #nginx監聽的埠 #授權 auth_basic "Kibana Auth"; auth_basic_user_file /etc/nginx/passwd/kibana.passwd; #密碼生成位置 location / { proxy_pass http://127.0.0.1:5600$request_uri; #kibana地址 proxy_redirect off; } } }
2.2 安裝Apache密碼生產工具:yum install httpd-tools
生成密碼:mkdir -p /etc/nginx/passwd
htpasswd -c -b /etc/nginx/passwd/kibana.passwd user ******
2.3 修改kibana配置檔案:server.port 和 server.host
2.4 啟動 kibana ,進入安裝目錄的bin目錄下:./kibana &
停止命令:netstat -tunlp | grep 埠
kill -9 程序id
2.5 啟動nginx:啟動命令全路徑 -c 配置檔案全路徑
/usr/sbin/nginx -c /etc/nginx/conf.d/nginx.conf
停止與kibana相同,檢視埠監聽程序id,kill即可