开发者

nginx to cache the dynamic URL

开发者 https://www.devze.com 2023-01-05 00:48 出处:网络
I have a website www.somesite1.com which gets al开发者_StackOverflow社区l its image content from www.somesite2.com

I have a website

www.somesite1.com which gets al开发者_StackOverflow社区l its image content from www.somesite2.com

At the moment each time an image is to be displayed we simply use an absolute URL to get it like this

img src="http://www.somesite2.com/event/image.jpg" /

So each time a user goes to www.somesite1.com for content www.somesite2.com gets hammered. and the nginx is in front of IIS, so I want to cache the image on nginx...not always get from IIS. Please tell me detail. Thanks very much~


Maybe too late but you can do that with the proxy module of nginx.

There are plenty of solutions and you didn't give enough details.

One solution is to have a proxy rule on (for example) /site2/ for the www.somesite1.com domain. These rule will forward request to www.somesite2.com.

And your absolute urls pointing to http://www.somesite1.com/site2/foo.png (for example).

Of course, depending of your url schemes, you can set something more elaborate and less visible (than this silly /site2/ rule).

0

精彩评论

暂无评论...
验证码 换一张
取 消