In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
If the images of the server are hacked by other websites, the bandwidth and access speed of the server will be affected. In this case, we need to set the hotlink protection feature for picture files or video files.
Hotlink protection simply means that you can access the resource directly, but you cannot put my resource link on your own server for others to access, especially for large files such as pictures or videos. It is easy to cause the server to respond slowly.
If it is not a picture bed, I am really afraid that other websites will directly use the pictures of this site. In this way, the traffic is likely to be brushed out at once, after all, CDN is bought with white money. Therefore, it is better to set up a hotlink protection, Nginx can complete this function.
Generally speaking, browsers implemented under the HTTP protocol will bring the URL of the current site when they visit site B from website A to indicate where the click came from. Therefore, this module of Nginx also depends on this, so if the hacker does not add this header, it is still impossible to have a happy anti-theft picture.
The documents on Nginx official website are as follows:
Syntax: valid_referers none | blocked | server_names | string.
Default:-
Context: server, location
Brief introduction of nginx referer instruction
The nginx module ngx_http_referer_module is usually used to block domain name requests from illegal sources. We should keep in mind that camouflaging Referer headers is very simple, so this module can only be used to prevent most illegal requests. We should keep in mind that some legitimate requests do not have referer source headers, so sometimes do not reject requests with empty source headers (referer).
So, we can add code to the server or location block, which I saved as valid_referers.conf:
Valid_referers none blocked server_names;if ($invalid_referer) {return 403;}
Then add include / etc/nginx/valid_referers.conf where needed, and of course, the prerequisite for doing this is that the valid_referers.conf has been placed under the / etc/nginx/valid_referers.conf path on the corresponding machine.
Example:
Location / articles/img {include / etc/nginx/valid_referers.conf; root / data/blog/code;}
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.