Skip to content


让nginx的expires和防盗链都有效

expires有效,防盗链失效  <code>    
             location ~* ^.+\.(jpg|jpeg|gif|png|css|js|swf)$ {
             access_log   off;
             root /opt/htdocs/career;
     expires 1h;
     #break;
     }

     location ~* ^.+\.(jpg|jpeg|gif|png|swf|rar|zip)$ {
    valid_referers none blocked *.c1gstudio.com;
    if ($invalid_referer) {
        rewrite ^/ http://leech.c1gstudio.com/leech.gif;
        return 412;
    }
     }

只有js和css的expire有效,防盗链有效

location ~<em> ^.+.(jpg|jpeg|gif|png|swf|rar|zip)$ { valid_referers none blocked </em>.c1gstudio.com; if ($invalid_referer) { rewrite ^/ <a href="http://leech.c1gstudio.com/leech.gif">http://leech.c1gstudio.com/leech.gif</a>; return 412; } } location ~* ^.+.(jpg|jpeg|gif|png|css|js|swf)$ { access_log off; root /opt/htdocs/career; expires 1h; #break; }</p> <p>

让expire和防盗链都有效

<br /> location ~<em> ^.+.(jpg|jpeg|gif|png|swf|rar|zip|css|js)$ { valid_referers none blocked </em>.c1gstudio.com; if ($invalid_referer) { rewrite ^/ <a href="http://leech.c1gstudio.com/leech.gif">http://leech.c1gstudio.com/leech.gif</a>; return 412; } access_log off; root /opt/htdocs/career; expires 1h; break;</p> <pre><code> }

Posted in Nginx, 技术.

Tagged with , , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.