Location issues with upload progress module

Valery Kholodkov valery+nginxen at grid.net.ru
Wed Oct 8 16:03:57 MSD 2008


> Hi,
> maybe somebody can tell how to work arround this. While its not a big
> issue
> and seems more related to Nginx overal location mechanics.
>
> I have played arround Nginx Upload Progress Module (
> http://wiki.codemongers.com/NginxHttpUploadProgressModule )
>
> The problem is afteradding the proxy_pass location (according to docs)
> nginx
> ( 0.7.17 ) forgets/doesnt use index.php on that path anymore as directory
> index ..
>
> eg http://myserver.com/up/ returns 502 Bad Gateway:
>
> 2008/10/08 14:20:56 [error] 3249#0: *1023 recv() failed (104: Connection
> reset by peer) while reading response header from upstream, client:
> 127.0.0.1, server: _, request: "GET /up/ HTTP/1.0", upstream:
> "http://127.0.0.1:80/up/", host: "127.0.0.1"
>
> while http://myserver.com/up/index.php works fine....
>
>
> The configuration:
> ------------------------------------------------------------
> http {
> ...
>   upload_progress proxied 5m;
>
>   server {
> ..
>        root   /data/web/root;
>        index  index.php index.htm;
>
>     location /up {
>         proxy_pass http://127.0.0.1;
>         proxy_redirect default;
>         track_uploads proxied 10s;
>      }
>
>      location ~ \.php$ {
>
>                 if (!-f $request_filename) {
>                         return 404;
>                 }
>                 fastcgi_pass   127.0.0.1:1026;
>                 fastcgi_index  index.php;
>                 include        fastcgi_params;
>
>                 track_uploads proxied 10s;
>      }
>
>   location ^~ /progress {
>     # report uploads tracked in the 'proxied' zone
>     report_uploads proxied;
>   }
>  }
> }
> ------------------------------------------------------------
>
>
>
> While I can leave the 'location /up' directive out of config at all what
> enables upload progress support on every *.php wanted to know if there is
> something wrong (directive order) or missing or just supposed to work like
> that?

Because location /up {} enables proxy for all locations starting from
"/up". If you want only exact URI "/up" to be affected by proxy
configuration, you should specify

location = /up {
         proxy_pass http://127.0.0.1;
         proxy_redirect default;
         track_uploads proxied 10s;
}

-- 
Best regards,
Valery Kholodkov





More information about the nginx mailing list