1. 程式人生 > >nginx+ apache htpassword實現kibana的密碼登入驗證

nginx+ apache htpassword實現kibana的密碼登入驗證

1.1.安裝pcre

2.解壓縮pcre-xx.tar.gz包。

3.進入解壓縮目錄,執行./configure

4.make & make install

5yum installpcre-devel

注意如果系統沒裝GCC外掛的時候回報錯:no acceptable C compiler found in $PATH

yum install gcc

yum install -y gccgcc-c++

請使用 prce8.38最新版本報錯是個坑

1.2.安裝openssl

2.解壓縮openssl-xx.tar.gz包。

3.進入解壓縮目錄,執行./config

4.make & make install

5yum install pcre-devel 

1.3.安裝zlib

2.解壓縮openssl-xx.tar.gz包。

3.進入解壓縮目錄,執行./configure

4.make & make install

1.4.安裝nginx

1.         獲取nginx,在http://nginx.org/en/download.html上可以獲取當前最新的版本。

2.         解壓縮nginx-xx.tar.gz包。

3.         進入解壓縮目錄,執行./configure --with-pcre=/usr/local/nginx/pcre2-10.20--with-zlib=/usr/local/nginx/zlib-1.2.8--with-openssl=/usr/local/nginx/openssl-1.0.2h--with-http_stub_status_module 

--with-http_ssl_module

4.         make &make install

5、啟動sbin/nginx-c conf/mynginx.conf

1.5.apache anth模組安裝

1yuminstall httpd

2htpasswd-c /usr/local/nginx/db/passwd.db thunder

3、修改ngnix.conf檔案:

server {

        listen       80;

        server_name  10.10.45.60;

        location / {

                auth_basic "secret";

                auth_basic_user_file/usr/local/nginx/db/passwd.db;

                proxy_pass http://10.10.45.60:5601;

                proxy_set_header Host$host:5601;

                proxy_set_header X-Real-IP$remote_addr;

                proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;

                proxy_set_header Via"nginx";

        }

    }

4、啟動sbin/nginx-c conf/mynginx.conf

5、停止ngnixpkill -9 nginx