公司要反代gravatar,搞完了把代码分享下,有兴趣的可以自己反代一个
proxy_cache_path /home/wwwroot/example.com/cache levels=1:2 keys_zone=gravatar:10m inactive=7d max_size=1g;
server
{
listen 80;
server_name example.com
location / {
proxy_cache gravatar;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 404 1m;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass https://secure.gravatar.com;
proxy_set_header Host "secure.gravatar.com";
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
}
access_log off; #access_log end
error_log /dev/null; #error_log end
}
1
lyragosa 2015-04-13 15:40:40 +08:00
我的网站是用php curl完成的,比较low
|
2
moliliang 2015-04-13 15:52:11 +08:00
server {
listen 80; server_name gravatar.rkidc.net; location / { default_type text/html; subs_filter_types text/css text/xml; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Referer http://2.gravatar.com; proxy_set_header Host 2.gravatar.com; proxy_pass http://2.gravatar.com; proxy_set_header Accept-Encoding ""; } } |
3
moliliang 2015-04-13 15:53:04 +08:00
没注意看内容,以为lz是来求反代的。。。
|
4
moliliang 2015-04-13 15:54:49 +08:00
其实我自己的网站程序是通过代码直接get的,然后通过七牛镜像,就好了。。。
|
5
isayme 2015-04-13 16:06:04 +08:00
不是可以用多说的么?
|
6
djyde 2015-04-13 21:40:56 +08:00
我直接七牛反代
|
7
xiqingongzi OP @isayme 公司想自己搞个。觉得多说太慢,而且不稳定
|
8
xiqingongzi OP @lyragosa 也行啊,能实现就好
|
9
xiqingongzi OP @moliliang 没找到类似的帖子,就自己发了个
|