Skip to content

Instantly share code, notes, and snippets.

@wbbim
Created May 12, 2015 15:51
Show Gist options
  • Save wbbim/d1e0d2eda4cc3ad9f68a to your computer and use it in GitHub Desktop.
Save wbbim/d1e0d2eda4cc3ad9f68a to your computer and use it in GitHub Desktop.
wo,com.ru图片代理
server
{
listen 80;
listen 443;
server_name wo.com.ru;
ssl_certificate /etc/nginx/ssl/wo.crt;
ssl_certificate_key /etc/nginx/ssl/wo.pem;
#location /{#这样的话就可以代理大部分网页 下面则限定代理文件后缀
location ~* .(jpg|png|gif|jpeg|bmp|css|js|txt|webp|xml|swf|mp3|ico)$ {
set $hostx "";
set $addrs "";
if ( $uri ~ "^/+([^/]+)/(.+)$") {
set $hostx $1;
set $addrs $2;
}
resolver 8.8.8.8;
proxy_redirect off;
proxy_pass http://$hostx/$addrs;
proxy_set_header referer "http://$hostx";
proxy_set_header Accept-Encoding '';
subs_filter_types application/javascript text/javascript;
subs_filter '$hostx' '$host/$hostx';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment