动物总动员电影免费观看,国产一线天在线观看,亚洲成人精品久久,www.夜色av.com,caoporn国产一区二区,国产精品毛片一区视频播不卡,91av456

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開(kāi)發(fā),龍巖分銷系統(tǒng)

nginx配置Http Basic Auth保護(hù)目錄

2015.09.10 | 1659閱讀 | 0條評(píng)論 | 通用代碼

注意,nginx 的 http auth basic 的密碼是用 crypt(3) 加密的,而apache是md5加密。所以生成時(shí): 

htpasswd -b -c site_pass username password

例如:基于整個(gè)網(wǎng)站的認(rèn)證,auth_basic在php解釋之前。 

server { 

   listen 80; 

   server_name www.wzjdgyp.com 0597seo.com; 

   root /wwwroot/0597seo.com; 

   index index.html index.htm index.php; 

   auth_basic "auth"; 

   auth_basic_user_file /usr/local/nginx/auth/nginx_passwd; 

   location ~ .php$ { 

      fastcgi_pass 127.0.0.1:9000; 

     fastcgi_index index.php; 

     include fastcgi_params; 

}

location ~ /\.ht { 

  deny all; 

}

access_log /logs/0597seo.com_access.log main; 

}

針對(duì)目錄的認(rèn)證,在一個(gè)單獨(dú)的location中,并且在該location中嵌套一個(gè)解釋php的location,否則php文件不會(huì)執(zhí)行并且會(huì)被下載。

auth_basic在嵌套的location之后。 

server { 

   listen 80; 

   server_name www.wzjdgyp.com 0597seo.com; 

   root /wwwroot/0597seo.com; 

   index index.html index.htm index.php; 

   location ~ ^/phpMyAdmin/.* { 

      location ~ \.php$ { 

          fastcgi_pass 127.0.0.1:9000; 

          fastcgi_index index.php; 

          include fastcgi_params; 

    }

 auth_basic "auth"; 

 auth_basic_user_file /usr/local/nginx/auth/auth_phpMyAdmin; 

}

location ~ .php$ { 

  fastcgi_pass 127.0.0.1:9000; 

  fastcgi_index index.php; 

  include fastcgi_params; 

}

location ~ /\.ht { 

  deny all; 

}

access_log /logs/0597seo.com_access.log main; 

}

這里注意,就是location ~ ^/phpMyAdmin/.* {…} 保護(hù)phpMyAdmin目錄下的所有文件。

如果你只設(shè)了/phpMyAdmin/ 那么直接輸入/phpMyAdmin/index.php還是可以訪問(wèn)并且運(yùn)行的。 

^/phpMyAdmin/.* 意為保護(hù)該目錄下所有文件。



htpasswd.zip


贊 (

發(fā)表評(píng)論

林甸县| 清流县| 陆丰市| 昔阳县| 临城县| 扎兰屯市| 杂多县| 呼玛县| 河间市| 双峰县| 道真| 花垣县| 安塞县| 岑巩县| 霍州市| 张家界市| 苍南县| 益阳市| 龙里县| 什邡市| 新竹县| SHOW| 静乐县| 鸡东县| 藁城市| 塘沽区| 卓资县| 迁安市| 清涧县| 渝中区| 外汇| 灵寿县| 贺州市| 饶平县| 望奎县| 旬邑县| 江永县| 马鞍山市| 喀喇沁旗| 博客| 青田县|