Simple method of LNMP picture anti-theft chain

Simple method of LNMP picture anti-theft chain

Time: July 24, 2012 Column: VPS Tutorial Author: Zhao Rong Click: 9139 times

 Proprietary computer room/advanced anti DDoS server/advanced anti DDoS VPS/American advanced anti DDoS/Los Angeles VPS/Los Angeles advanced anti DDoS server

I saw a friend asking in QQ group yesterday LNMP In fact, the military brother has already answered the question about how to prevent chains from being stolen in the environment. Here I will share it with you and take a note at the same time.

 Simple method of LNMP picture anti-theft chain

Since nginx does not support. htaccess, it is impractical to prevent it directly from this aspect. We need to modify the configuration file to solve this problem.

First, we find the conf file of the domain name that needs the anti leech. The path is/usr/local/nginx/conf/vhost/, such as zrblog.net.conf

It's better to back it up first, so as not to make mistakes and directly cover it back. This is a good habit!!!

Find the following section:

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

Change it to:

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
valid_referers none blocked www.zrblog.net zrblog.net;
if ($invalid_referer) {
rewrite ^/ http:// vpsaa .com/404.jpg;
#return 404;
}
expires 30d;
}

Please revise the above content according to your own situation. I will give you a basic explanation here.

The first line gif | jpg | jpeg | png... These are the file types you need to prevent piracy. You can add some suffix types;

The third line is the domain name of your website, that is, the domain name released. If there are multiple domains, please add them, and pay attention to the blank space;

The fifth line is the picture seen by the pirate chain. A 404.jpg is returned. The source address of the picture must be able to be linked outside. Otherwise, the picture seen by others is just a XX.

After that, save it, upload it to the original location, and then restart lnmp to make it effective.

/root/lnmp restart

In addition, a friend asked how to prevent collection. It seems that there is no particularly effective method for this problem at present. It is suggested that you can study it from the system level, such as the limitation of iptables rules.

 Advanced Defense VPS/Los Angeles Advanced Defense/Advanced Defense Server/20 year old computer room

Statement: Blogs are only for sharing information and are not recommendations. Websites do not participate in transactions and are not intermediaries. The content only represents personal views and is not authoritative. Readers should consider it and take their own risks! Every penny and every commodity is still the eternal truth. Juvenile readers (including physical and psychological) should visit this website with their guardians! This article is written by( Zhao Rong )Original compilation, reprint, please keep the link: Simple method of LNMP picture anti-theft chain The code is not easy, please do not copy or paste!
About using: This website mainly shares server and VPS information, and does not provide any product sales or purchase. All visitors please purchase and use products within the scope of national laws and regulations. QQ group discussion: 683851361
About safety: Any IDC has the possibility of going bankrupt and running away. The host line is even more uncontrollable. Monthly payment and backup are your best choices. Please keep good and regular backup habits

Simple method of LNMP image anti-theft chain: there are currently 11 messages

  1. 8th floor
    Hong Kong Insurance :

    Why didn't I do it effectively? I tested it on Sina blog and showed the pictures.

    2017-06-02 10:36 [Reply]
  2. 7th floor
    liva :

    Sister Rong, why is your station sometimes in Singapore, sometimes in Alibaba Cloud?

    2014-01-16 23:26 [Reply]
  3. 6th floor
    Luo Chen :

    I don't know why the theme background will not be displayed in this way 😡

    2014-01-16 15:48 [Reply]
    • Zhao Rong :

      Well, no, is the theme background local?

      2014-01-16 16:03 [Reply]
  4. I have tried several times but failed. I don't know why.... 😥 😥

    2013-12-09 10:02 [Reply]
    • Zhao Rong :

      It should be OK. I tried several times and it was OK.

      2013-12-09 10:05 [Reply]
  5. 4th floor
    Royal Yuanlin :

    Excuse me, after I change to https, the picture of the anti-theft chain will also be displayed?

    2013-04-22 20:58 [Reply]
  6. floor
    Host code :

    There is also a simple way. With CDN, most CDNs have anti-theft chain function..

    2012-07-28 21:15 [Reply]
    • Zhao Rong :

      En En, this is more convenient, ha

      2012-07-28 21:15 [Reply]
  7. This is judged by http referrer. The referrer can be forged, but it must be effective. Hehe

    2012-07-25 12:56 [Reply]
  8. sofa
    seamus :

    🙂 Good Dongdong

    2012-07-24 19:12 [Reply]

Comment


 hostyun  locvps

Advertise