Nginx upload module (v 2.2.0) :: 502 Bad Gateway
Piotr Polok
toplek at polok.pl
Mon Sep 5 09:33:26 UTC 2011
> Your setup includes:
> client_max_body_size 100m;
>
> Do you also your php.ini configured to accommodate 100m files?
> Check:
> memory_limit (should be something able to cope with 100M files)
> post_max_size (should be >= 110M)
> file_uploads (should be On)
> upload_max_filesize (should be >= 100M)
Thank you all for help!
I found the solution on this thread:
http://www.ruby-forum.com/topic/1432037
The problem was that I did not wrote the form handler script.
This is my working configuration of nginx:
/usr/local/nginx/conf/nginx.conf:
----
worker_processes 20;
error_log logs/error.log notice;
working_directory /usr/local/nginx/html;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
client_max_body_size 100m;
# Upload form should be submitted to this location
location /upload {
# Pass altered request body to this location
upload_pass /my-form-handler;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8
9 should exist
upload_store /tmp 1;
# Allow uploaded files to be read only by user
upload_store_access user: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$";
}
include fastcgi.conf;
location = /my-form-handler {
fastcgi_pass 127.0.0.1:9000;
}
}
}
----
/usr/local/nginx/html/my-form-handler
----
<?php
header("Content-Type: text/plain");
print("GET: "); print_r($_GET);
print("POST: "); print_r($_POST);
print("FILES: "); print_r($_FILES);
?>
----
--
best regards
Piotr Polok
More information about the nginx
mailing list