2012-08-24 9 views

答えて

8

次のコンテキストのいずれかにngx_http_auth_basic_module設定を置くことができます。

http, server, location, limit_except 

あなたのバージョン

location ~ ^/ 

あなたserverセクションで別の宣言の場所を持っていない場合にのみ動作します
例:

server { 
    ... #some server settings 
    location/{ # full equivalent for "~ ^/" 
     auth_basic on; 
     auth_basic_user_file /path/to/some/file; 
    } 
    location /other_location { 
     # here http_auth not inherited 
    } 
} 

http_authの設定をserverセクションに設定すると、このserverのすべての場所がこの設定を継承します。
例:

server { 
    ... # some server settings 
    auth_basic on; 
    auth_basic_user_file /path/to/some/file; 
    location/{ 
     # HERE http_auth settings would be 
     # inherited from previous configuration level. 
    } 
} 
関連する問題