Skip to content


让nginx的expires和防盗链都有效

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

让expire和防盗链都有效

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

}

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.