In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Demand:
Usually sites, will want to make their own website videos and pictures, from being embezzled, after all, video traffic, spend money (tuhao can not consider) ~ ~.
First, go straight to the nginx configuration file first.
Server {listen 80th serverSecretname www.test.com;root / data/web/;index index.php index.html;access_log / data/logs/nginx/biao.madacode.access.log main;location / {root / home/data/;} error_page 404 / usr/local/nginx/html/404.html;location ~. *\. (wma | wmv | asf | mp3 | mp4 | zip | rar | jpg | png | swf | flv) ${valid_referers none blocked server_names *. Test.com http://IP;if ($invalid_referer) {return 403;} expires 24h accessory log off } location ~ /\. {deny all;}}
Second, explanation of hotlink protection core configuration file
Location ~. *\. (wma | wmv | asf | mp3 | mp4 | mmf | zip | rar | jpg | gif | png | swf | flv) ${valid_referers none blocked server_names * .test.com http://IP;if ($invalid_referer) {return 403;} expires 24hitaccessory log off;}
Vaild_referers valid reference connection, as follows, otherwise enter $invaild_refere and return 403 forbiden.
1 、 none
If the header of the "Referer" source is empty
2 、 blocked
The "Referer" source header is not empty, but the values are deleted by the proxy or firewall, none of which starts with http:// or https://.
3 、 server_names
The "Referer" source header contains the current server_names (current domain name)
Third, simulated case test
1. Add-- referer simulation reference to see the result directly. Prove that the above configuration is OK.
[root@test] # curl-- referer http://baidu.com-I http://www.test.com/temp/T19254/20190820/video_out_out/1/0011.mp4HTTP/1.1 403 ForbiddenServer: TengineDate: Wed, 21 Aug 2019 09:54:44 GMTContent-Type: text/htmlContent-Length: 639Connection: keep-alive
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.