FAQ

Page Discussion Edit History

ChsHttpAuthBasicModule

(Redirected from NginxChsHttpAuthBasicModule)

Contents

[edit] ngx_http_auth_basic_module

璇ユā鍧楀彲浠ヤ娇浣犱娇鐢ㄧ敤鎴峰悕鍜屽瘑鐮佸熀浜 HTTP 鍩烘湰璁よ瘉鏂规硶鏉ヤ繚鎶や綘鐨勭珯鐐规垨鍏堕儴鍒嗗唴瀹广

__瀹炰緥閰嶇疆__

location  /  {
: auth_basic            "Restricted";
: auth_basic_user_file  conf/htpasswd;
}

[edit] 鎸囦护

  • [#auth_basic auth_basic]
  • [#auth_basic_user_file auth_basic_user_file]

Template:Anchor

[edit] auth_basic

璇硶锛 auth_basic [ text|off ]

榛樿鍊硷細 auth_basic off

浣滅敤鍩燂細 http, server, location, limit_except

璇ユ寚浠ゅ寘鍚敤浜 HTTP 鍩烘湰璁よ瘉 鐨勬祴璇曞悕鍜屽瘑鐮併傚垎閰嶇殑鍙傛暟鐢ㄤ簬璁よ瘉棰嗗煙銆傚 "off" 鍙互浣垮叾瑕嗙洊鏉ヨ嚜涓婂眰鎸囦护鐨勭户鎵挎с

Template:Anchor

[edit] auth_basic_user_file

璇硶锛 auth_basic_user_file the_file

榛樿鍊硷細 no

浣滅敤鍩燂細 http, server, location, limit_except

璇ユ寚浠や负鏌愯璇侀鍩熸寚瀹 htpasswd 鏂囦欢鍚嶃

鏂囦欢鏍煎紡绫讳技浜庝笅闈㈢殑鍐呭锛

鐢ㄦ埛鍚:瀵嗙爜
鐢ㄦ埛鍚2:瀵嗙爜2:娉ㄩ噴
鐢ㄦ埛鍚3:瀵嗙爜3

瀵嗙爜蹇呴』浣跨敤鍑芥暟 crypt(3) 鍔犲瘑銆 浣犲彲浠ヤ娇鐢ㄦ潵鑷 Apache 鐨 htpasswd 宸ュ叿鏉ュ垱寤哄瘑鐮佹枃浠躲

浣犱篃鍙互浣跨敤perl 鍒涘缓瀵嗙爜鏂囦欢,pw.pl 鐨勫唴瀹癸細

#!/usr/bin/perl
use strict;

my $pw=$ARGV[0] ;
print crypt($pw,$pw)."\n";

鐒跺緦鍩疯

chmod +x pw.pl
./pw.pl password
papAq5PwY/QQM

papAq5PwY/QQM 灏辨槸password 鐨刢rypt()瀵嗙爜

[edit] 鍙傝

鍘熷鏂囨。