首先找到微信图片服务器的 IP
$ ping www.fuwuqijia.com PING ssd.tcdn.qq.com (110.81.153.148): 56 data bytes 64 bytes from 110.81.153.148: icmp_seq=0 ttl=56 time=10.590 ms 64 bytes from 110.81.153.148: icmp_seq=1 ttl=56 time=8.083 ms 64 bytes from 110.81.153.148: icmp_seq=2 ttl=56 time=10.891 ms 64 bytes from 110.81.153.148: icmp_seq=3 ttl=56 time=10.202 ms ^C --- ssd.tcdn.qq.com ping statistics --- 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 8.083/9.941/10.891/1.100 ms
配置微信图片反向代理
location ~ /mmbiz_(.*)/ { proxy_pass http://59.57.18.143; proxy_set_header Host "www.fuwuqijia.com"; proxy_set_header Referer ""; }
移除微信图片的域名
使用 sub_filter 移除微信图片的域名
sub_filter "https://www.fuwuqijia.com" ""; sub_filter_once off;
到这儿以微信文章图片防盗链。