<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Sep 28, 2012, at 13:31 , Jaroslav wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I am afraid they not :( <div><br></div><div>Those images by default are expiring in epoch. </div><div>You want to say than nginx will handle this 304 thing if those headers are correctly set in PHP? </div></blockquote><div><br></div>Not nginx but browsers: they do not send If-Modified-Since/If-None-Match header fields to nginx.</div><div>If these images never expire then you can add</div><div><br></div><div>location /bin/ {</div><div>    expires 7d;</div><div>    add_header  ETag  '"anything"';</div><div><br></div><div><br></div><div><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">--<br>Igor Sysoev<br></span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><a href="http://nginx.com/support.html">http://nginx.com/support.html</a></span></div><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br></span></div></span></span></div><blockquote type="cite"><div>
Can this be 'fixed' without touching php code? </div><div><br></div><div>Thank you<br><br><div class="gmail_quote">On 28 September 2012 12:24, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap:break-word"><div><div class="im"><div>On Sep 28, 2012, at 13:15 , Jaroslav wrote:</div><br><blockquote type="cite">
Thank you very much Igor for a fast response!<div><br></div><div>So far I see the performance increase. I see the logs being created. And no longer see so lot access logs to apache images.</div><div><br></div><div>my config is:</div>

<div><div>            location /bin/ {</div><div>                expires 7d;</div><div>                add_header X-Cache "Backend2-cache";</div><div>                proxy_pass <a href="http://site.com/" target="_blank">http://site.com</a>;</div>

<div><br></div><div>                proxy_cache my-cache;</div><div>                proxy_cache_valid  200 302  360m;</div><div>                proxy_cache_valid  404      1m;</div><div>            }</div><div><br></div>
<div>
One more question is left in my mind, I see the expire headers are set, but the HTTP response status is always 200. </div><div>is there somewhere a way to make it respond with status 304 (not modified) ? </div></div></blockquote>
<div><br></div></div><div>Do these images have "Last-Modified" or "ETag" header field ? </div><div class="im"><div><br></div><div><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><br>
--<br>Igor Sysoev<br></span></div><div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><a href="http://nginx.com/support.html" target="_blank">http://nginx.com/support.html</a></span></div>
<div><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><br>
</span></div></span></span></div><blockquote type="cite"><div>
Thank you</div><div><br><div class="gmail_quote">On 28 September 2012 11:26, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word"><div><div><div><div>On Sep 28, 2012, at 12:10 , Jaroslav wrote:</div><br><blockquote type="cite"><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Hello everyone,</span><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">I am using nginx as proxy before apache a long time already. And it is really terrific what it does.</div>
<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Ram usage dropped like 3 times</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
I mainly set up image cache headers in nginx config</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


Today I've spotted, that one of vhosts is generating images ALWAYS on the fly, images are accessed like: </div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
/bin/825?w=121&h=87&cutted=fit</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">/bin/4999?w=222 </div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


/bin/5113?w=121&h=87&cutted=fit</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
etc..</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
I wonder is there any way I can tell nginx to store those images locally, ie for a week, and serve them</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">to other users, so it won't be resized multiple times?</div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
I tried googling but don't even know how/where to start from..</div></blockquote><br></div></div><a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache" target="_blank">http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache</a></div>

<br><div>
<div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><br>

--<br>Igor Sysoev<br></span></div><div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><a href="http://nginx.com/support.html" target="_blank">http://nginx.com/support.html</a></span></div>
</div></div></blockquote></div></div></blockquote></div></div><br></div><br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div>
_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>http://mailman.nginx.org/mailman/listinfo/nginx</blockquote></div><br></body></html>