Nginx handle of large uploads , proxy to cgi?

Joe Shang joe.shang at gmail.com
Sun Nov 23 01:00:42 MSK 2008


Very weird issue.

I am testing nginx with PHPMOTION, but there is a problem.

Its being tested on:

http://phpmotion.aptget.com/

The problem is PHPMOTION sends the upload to a cgi script, which I
have set in nginx to proxy all cgi scripts to Apache itself using:

                location ~ \.cgi$ {
                        proxy_pass http://127.0.0.1:82;
                        proxy_redirect off;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
                }


Works great, cgi works great, but when its sending a large upload, I
ran an strace to the script uploading:

stat64("/home/phpmotio/public_html/temp/aaf1b8635490edaf34473de6e1cd849c/flength",
0xb7fdc900) = -1 ENOENT (No such file or directory)
time(NULL)                              = 1227391028
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0})               = 0
time(NULL)                              = 1227391029
stat64("/home/phpmotio/public_html/temp/aaf1b8635490edaf34473de6e1cd849c/flength",
0xb7fdc900) = -1 ENOENT (No such file or directory)
time(NULL)                              = 1227391029
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0})               = 0
time(NULL)                              = 1227391030
write(1, "Content-type: text/xml\n\n<?xml ve"..., 176) = 176
exit_group(0)                           = ?
Process 28593 detached

Which back to the user gets the error "ERROR: Failed to find flength
file" , because it couldn't find the above file, its there to show to
the user the upload progress bar.

But the weird thing is Nginx is still accepting the upload in the
background, so it is working, and it does everything else properly,
conversion, but nginx is the one taking over the upload.

Is there a setting I can do in nginx somewhere so when uploading to
via cgi, etc, to work properly as the script intended somehow?

Or is it simply that this won't work properly on Nginx?

Thanks!





More information about the nginx mailing list