Upload file problem (500 Internal Server Error)

HI,

I’m using version: ‘nginx version: nginx/1.1.0’

While uploading file I’m getting an error: ‘500 Internal Server Error’

This is an nginx.log result:


2011/09/01 10:39:49 [alert] 28764#0: accept() failed (24: Too many open
files)
2011/09/01 10:39:49 [alert] 28764#0: accept() failed (24: Too many open
files)
2011/09/01 10:39:49 [alert] 28764#0: accept() failed (24: Too many open
files)
2011/09/01 10:39:49 [alert] 28764#0: accept() failed (24: Too many open
files)
2011/09/01 10:39:49 [alert] 28764#0: *13013 socket() failed (24: Too
many open files) while connecting to upstream, client: 127.0.0.1,
server: 192.168.0.222, request: “POST /upload HTTP/1.0”, upstream:
http://127.0.0.1:80/upload”, host: “localhost”, referrer:
http://192.168.0.222/CRM/upload4.html
2011/09/01 10:39:49 [crit] 28764#0: *13013 open() “/var/www/50x.html”
failed (24: Too many open files), client: 127.0.0.1, server:
192.168.0.222, request: “POST /upload HTTP/1.0”, upstream:
http://127.0.0.1:80/upload”, host: “localhost”, referrer:
http://192.168.0.222/CRM/upload4.html

The ‘lsof -n | wc -l’ command gives a result: ‘1980’ value.
The ‘cat /proc/sys/fs/file-max’ command gives a result: ‘203296’.

So it is not a too many open files problem?

The upload4.html containt:

Test upload

Select files to upload


-----

Please help :wink:


best regards
Piotr P.

try this?

worker_rlimit_nofile 10000;

On Thu, 1 Sep 2011 17:49:29 +0800, li zJay wrote:

try this?

worker_rlimit_nofile 10000;

HI,

Thank you, The ‘worker_rlimit_nofile 10000’ is not solving the problem.

I have added a ‘fastcgi_pass 127.0.0.1:9000’ to a ‘/upload’ location
and now I’m getting the ‘No input file specified.’ error on html form
and the ‘/var/log/nginx/error.log’ is clear.

This is my ‘/upload’ configuration:


location /upload {
#Pass altered request body to this location
upload_pass @test;

#Store files to this directory
#The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should
exist
upload_store /var/www/upload;

#Allow uploaded files to be read only by user
#upload_store_access user:r;
upload_store_access user:rw group:rw all:r;

#Set specified fields in request body
upload_set_form_field $upload_field_name.name “$upload_file_name”;
upload_set_form_field $upload_field_name.content_type
“$upload_content_type”;
upload_set_form_field $upload_field_name.path “$upload_tmp_path”;

#Inform backend about hash and size of a file
upload_aggregate_form_field “$upload_field_name.md5”
“$upload_file_md5”;
upload_aggregate_form_field “$upload_field_name.size”
“$upload_file_size”;

upload_pass_form_field “^submit$|^description$”;

upload_cleanup 400 404 499 500-505;

fastcgi_pass 127.0.0.1:9000;
}

Pass altered request body to a backend

location @test {
proxy_pass http://localhost:80;
}

you can try to add such line to /etc/security/limits.conf
nginx soft nofile 131072
nginx hard nofile 1048576

and fastcgi_pass to run PHP
you need to set SCRIPT_FILENAME, you may first include fastcgi_params at
/etc/nginx (if you install nginx with binary), and then add such line
before fastcgi_pass: fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
Piotr P. Wrote:

I have added a ‘fastcgi_pass 127.0.0.1:9000’ to a
upload_pass @test;

upload_aggregate_form_field
fastcgi_pass 127.0.0.1:9000;
Piotr P.


nginx mailing list
[email protected]
nginx Info Page

Posted at Nginx Forum:

On Thu, 01 Sep 2011 19:17:06 -0400, magicbear wrote:

$document_root$fastcgi_script_name;
HI,

Thanks, this is also not solving the problem. I will start from the
beginning in new thread.


best regards
Piotr P.


POLOK WELDING
44-121 Gliwice
ul. Sowińskiego 3
NIP: 631-112-45-46

tel: (32) 725 77 77
fax: (32) 444 64 50