技术解析

请教专业人士:nginx反向代理网站图片无法显示
0
2021-05-31 10:58:50
idczone
小弟是一个牙医,最近业余时间开始迷恋nginx,做了一个简单的反向代理nytimes,但是图片无法显示。对方站的图片在graphics8.nytime.com,是akamai的cdn,我猜测nginx反代时直接解析对方ip,而直解析后的ip是无法访问akamai内容的,因此无法打开这些图片。不知道是不是这样,有没有什么解决办法呢?


server
{
listen 80;
server国外服务器_name news.xxx.org *.news.xxx.org;

if ( $host ~* (.*)\.(.*)\.(.*))
{
set $domain $1;
}
location /
{
proxy_pass http://170.149.172.130;

proxy_set_header Host $host;

proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
subs_filter 'www.nytimes.com' 'news.xxx.org' ig;
subs_filter 'graphics8.nytimes.com' 'graphics8.news.xxx.org' ig;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding ""; # GZIP
}
access_log off;
}

server
{
listen 80;
server_name graphics8.news.xxx.org;


location /
{
proxy_pass http://graphics8.nytimes.com;

proxy_set_header Host $host;

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 Accept-Encoding ""; # GZIP
}
access_log off;
}
proxy_set_header Host graphics8.nytimes.com;

http://news.sohu.com/20111107/n324790318.shtml
牙医看看病把J、B塞进患者嘴里了。

@livid

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服