2015-07-01 29 views
0

我試圖解決類似這裏所描述的問題:nginx的:不要求localnet的密碼+滿足任何原因403

Nginx authentication except those on local network

保護我所有的網站使用LDAP身份驗證,

但我想一個「位置」,使可用而不 AUTH爲localnet的,所以我的配置是這樣的:

server { 
    auth_ldap "LDAP Authentication"; 
    auth_ldap_servers auth1; 

    location /for_localnet/ { 
    satisfy any; 
    allow 192.168.0.0/16; 
    deny all; 
#I try with and without lines bellow 
    auth_ldap "LDAP Authentication"; 
    auth_ldap_servers auth1; 
    } 
} 

它的工作如預期的「localnet的(1 92.168.x.x)「,但對於 從互聯網訪問它顯示錯誤403,如果我打開http://site/for_localnet/

所以我要打開「http://site」它要求的密碼,在那之後我可以打開 http://site/for_localnet/,所以問題如何強制nginx的詢問密碼 當我打開「http://site/for_localnet/」從互聯網上?

回答