Welcome! Log In Create A New Profile

Advanced

Re: issues about nginx proxy_cache

J.J J
May 17, 2015 09:30PM
If you access it correctly, nginx will send the request to backend and pass
response which is 302-redirect-link in your case back to the browser.

Check the "302-redirect-link", I think it should be an address to
http://192.168.15.159:7090 not to nginx(port 8064/8065), that's why the
browser bypasses nginx.

Also note, proxy_store does nothing to the stored file, it's quite
different from proxy_cache.

On Fri, May 15, 2015 at 4:38 PM, 紫凌之魂 <1070903212@qq.com> wrote:

> 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
>
>
>
>
>
>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

issues about nginx proxy_cache

紫凌之魂 May 15, 2015 04:40AM

Re: issues about nginx proxy_cache

J.J J May 17, 2015 09:30PM

Re: issues about nginx proxy_cache

Valentin V. Bartenev May 18, 2015 06:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 177
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready