issues about nginx proxy_cache

紫凌之魂 1070903212 at qq.com
Fri May 15 08:38:36 UTC 2015


Hi:
   Dear all
   It is very pleasure to join in nginx mail list, but exactly i met a problem When I use nginx1.7.9 as a reverse-proxy-server.  more details as follows:
my design requirements are those:
   what  I want is that nginx download the files  to local by parsing response-http-302-code .
   But Unfortunately , nginx transmit the  302-redirect-link to my browser directly. When my browser receive the response,it download files from redirected-link.
   So means that It doesn't via nginx when download the video-file.


for example:			


my-browser ----------> Server-A(nginx)---------->Server-B(Server local file)     Server-C(Server has video-file)
|<-------302+C-addr-------| <--------302 C-addr--------|
|----------------------request video file------------------------------------------------->|
|<-----------------------200 OK video file  -----------------------------------------------|
			 
What my problem is Server-A dosen't cache the video file.
I try to these two cache strategies as follows,but nothing effects,how can I fix it.




First I use proxy_store nginx.conf as follows :
-----------------------------------------------------------
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    server {
        listen       8065;
        server_name  localhost;
        location / {
            expires 3d;
            proxy_set_header Accept-Encoding '';
            root /home/mpeg/nginx;
            proxy_store on;
            proxy_store_access user:rw group:rw all:rw;
            proxy_temp_path /home/mpeg/nginx;
            if ( !-e $request_filename)  {
                 proxy_pass http://172.30.25.246:8099;
            }
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
------------------------------------------------------------
And then I use proxy_cache,nginx.conf as follows
------------------------------------------------------------------------
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
	client_body_buffer_size 512k;
	proxy_connect_timeout 10;
	proxy_read_timeout 180;
	proxy_send_timeout 5;
	proxy_buffer_size 16k;
	proxy_buffers 4 64k;
	proxy_busy_buffers_size 128k;
	proxy_temp_file_write_size 128k;
	proxy_temp_path /home/mpeg/cache/temp;
	proxy_cache_path /home/mpeg/cache levels=1:2 keys_zone=content:20m inactive=1d max_size=100m;
    server {
        listen       8064;
        server_name  localhost;
        location / {
            proxy_cache content;
            proxy_cache_valid 200 302 24h;
            proxy_cache_valid any 1d;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $remote_addr; 
            proxy_cache_key $host$uri$is_args$args;
            proxy_pass http://192.168.15.159:7090;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


}
---------------------------------------------------------------------------

anything will be help , Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150515/c1762f22/attachment.html>


More information about the nginx mailing list