在nginx配置服務中,建立訪問**密碼認證。
1)需要ngx_http_auth_basic_module模組
語法:
syntax: auth_basic string | off;預設是關閉的,使用位置在http,server,location標籤。
2)例子:
location /3)首先配置出儲存使用者和密碼的檔案htpasswd
使用htpasswd命令進行建立登入使用者和密碼
引數:
1 -c:建立乙個加密檔案;a、檢視系統是否安裝了htpasswd命令2 -n:不更新加密檔案,只將加密後的使用者名稱密碼顯示在螢幕上;
3 -m:預設採用md5演算法對密碼進行加密;
4 -d:採用crypt演算法對密碼進行加密;
5 -p:不對密碼進行進行加密,即明文密碼;
6 -s:採用sha演算法對密碼進行加密;
7 -b:在命令列中一併輸入使用者名稱和密碼而不是根據提示輸入密碼;
8 -d:刪除指定的使用者。
1 root@oldboy nginx]# which htpasswdb、安裝htpasswd命令2 /usr/bin/which: no htpasswd in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@oldboy nginx]# yum install http -yc、使用htpasswd命令建立密碼檔案htpasswd
2 adding password for user taili01
d、在原檔案htpasswd中增加新的使用者
1 [root@oldboy nginx]# htpasswd -b ./htpasswd taili02 123456e、檢視htpasswd檔案內容2 adding password for user taili02
1 [root@oldboy nginx]# cat ./htpasswd4)配置nginx.conf檔案2 taili01:zcn8exnjt3oyy
3 taili02:ldjrlzzuwxh/g
5)訪問**
Nginx 伺服器配置
我是body內容 我是html注釋內容 在瀏覽器上看到當前頁面的顯示內容兩種方式 1,直接拖動該html檔案到瀏覽器中 2,將該檔案部署到伺服器 bs結構中的關鍵服務軟體,可以執行各種程式,提供各種資源資訊,例如 tomcat nginx,jboss 中,通過瀏覽器位址列訪問該檔案 apache 組...
nginx伺服器配置
一 上傳 解壓 root node0719 tar zxvf tengine 2.1.0.tar.gz二 預編譯 root node07192 cd tengine 2.1.0 root node07192 tengine 2.1.0 configure 三 補全需要的編譯環境 c編譯環境 redi...
nginx配置二(伺服器配置)
include 主模組指令,實現對配置檔案所包含的檔案設定,可以減少主配置檔案的複雜度,類似於apache中的include方法,0.4.4版本以後,include指令已經能夠支援檔案萬用字元 default typelog format nginx的httplog模組指令,用於指定nginx日誌輸...