home page / Tutorial Notes / LNMP notes: setting image immobilizer

LNMP notes: setting image immobilizer

Recently, it was found that someone collected WordPress University With this blog, we had to cancel the feed full text output of WordPress University, and add a picture security chain (although that traffic is nothing, but I am not happy).

Here, I am very glad that you have recognized WordPress University, and I also welcome you to come here often. But really, I seldom update and maintain a website so seriously. I just want to communicate with you as much as possible. I hope you can understand and support me. In other words, if you were me, would you like to see your website being collected? So, here, I want to say to my buddies: I hope that I don't collect articles from him, so that he can have a reason to insist on updating. Thank you!

A simple picture of chain theft prompt is set:

 wpdaxue.com

LNMP picture immobilizer chain

Nginx server does not support. htaccess, so we have to modify the virtual host configuration file to achieve it.

Edit the configuration file of the virtual host where the picture is located:

 one
 vi / usr / local / nginx / conf / vhost / one hundred and twenty-three . wpdaxue . com . conf

Please modify the above 123.wpdaxue.com.conf as your configuration file

Find the following code:

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

Revised as:

 one two three four five six seven eight nine
 location ~ .* \ . ( gif | jpg | jpeg | png | bmp | swf ) $ { valid_referers none blocked www . wpdaxue . com wpdaxue . com cmhello . com www . cmhello . com ; 
 if  ( $invalid_referer )  { rewrite ^ / http : //www.wpdaxue.com/wpdaxue.com.png;
 #return 404; } expires 30d ; 
 }

Note that the domain name in the third line above should be changed to your own domain name (multiple domain names should be separated by spaces), and the address of the pirate picture prompt in the fifth line should be changed (this picture can't restrict pirate, otherwise others' websites will see a red cross)

Save the file and restart lnmp:

 one
 / root / lnmp restart

Finish it.

© 2009-2020 CMHELLO. COM · WordPress based
Return top