2017-04-25 170 views
0

如何使基本身份驗證排除重寫的文件?nginx重寫爲htaccess重寫

location ~ "^/blank.gif" { 
    auth_basic off; 
} 

location/{ 
    auth_basic "Restricted Content"; 
    auth_basic_user_file /etc/nginx/.htpasswd; 
} 

回答

0

解決!

SetEnvIf Request_URI "/blank.gif" noauth=1 

RewriteEngine on 
RewriteRule ^blank.gif$ count.php 

AuthType Basic 
AuthName "Restricted Content" 
AuthUserFile /home/admin/web/domain.com/public_html/.htpasswd 

Order Deny,Allow 
Satisfy any 
Deny from all 
Require valid-user 
Allow from env=noauth