nginx防盗链设置

#防盗链设置

location ~* \.(jpe?g|png|gif|php|html|htm|zip|apk|plist|ipa)$ {

# referer_hash_bucket_size 64;

# referer_hash_max_size 2048;

      valid_referers none blocked apicloud.com *.apicloud.com ;

      if ($invalid_referer) {

        return   403;

    }

proxy_pass http://WEB;  #注意WEB后面不能有'/'

proxy_redirect  off;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Cookie $http_cookie;

chunked_transfer_encoding  off;

proxy_http_version 1.1;

}


你可能感兴趣的:(nginx,防盗链)