Welcome! Log In Create A New Profile

Advanced

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Piotr Polok
September 05, 2011 05:34AM
> 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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Piotr Polok September 05, 2011 03:02AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Guillermo Garron September 05, 2011 04:06AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Piotr Polok September 05, 2011 04:18AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Guillermo Garron September 05, 2011 04:40AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Piotr Polok September 05, 2011 04:56AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Mark Alan September 05, 2011 05:12AM

Re: Nginx upload module (v 2.2.0) :: 502 Bad Gateway

Piotr Polok September 05, 2011 05:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 188
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