久成视频在线观看免费-先锋影音资源影音中在线不卡-久久精品—区二区三区美女-久久国产免费一区二区三区

<track id="icesm"></track>

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

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

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

      2015.09.10 | 1646閱讀 | 0條評論 | 通用代碼

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

      htpasswd -b -c site_pass username password

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

      server { 

         listen 80; 

         server_name xjjjv6omnt78jk.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; 

      }

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

      auth_basic在嵌套的location之后。 

      server { 

         listen 80; 

         server_name xjjjv6omnt78jk.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還是可以訪問并且運行的。 

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



      htpasswd.zip


      贊 (

      發(fā)表評論