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.