Anti-leech settings for nginx reverse proxy

Source: Internet
Author: User
Tags nginx reverse proxy

I will share my experiences in setting up anti-leech protection. If I use feresers to set anti-leech protection after nginx reverse proxy, all file targeting will fail. After a test, it is found that you only need to manually set proxy_pass when the if statement is passed. In this case, the location/{} configuration section does not take effect,

The sample configuration is as follows:

Server {Listen 80; SERVER_NAME test.luoo.net; # access_log/home/www/logs/luoo.net _ access. log; location ~ . *\. (MP3 | Ogg | AAC) $ {valid_referers none blocked bus. FM *. bus. FM luoo.net * .luoo.net; if ($ invalid_referer) {return 403;} proxy_pass http: // 219. 151. *. *: 8090;} location/{proxy_pass http: // 219. 151. *. *: 8090 ;}}

The website is published on port 8090 of the server and uses the nginx80 port as the reverse proxy. It also makes a simple judgment on the request source (validreferes) and request target (MP3/Ogg ), if the rule is not met, a 403 error is returned.

So far, the tutorials on the Internet have taught you how to set this method. Now, since you are setting a reverse proxy, you can add one more proxy_pass after if, at the same time, the location/{} section does not work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.