Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up the Nginx upload module to handle file uploads for an app running behind it in reverse proxy mode. It works locally but not on the server (EC2 Ubuntu AMI). I've compiled Nginx myself with the upload module included. Here's the relevant bit of my nginx.conf (from inside the server section):

    location /upload {
      # pass request body to here
      upload_pass /upload_endpoint;

      # Store files to this directory
      # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist    
      # i.e. make sure to create /u/apps/bugle/shared/uploads_tmp/0 /u /apps/bugle/shared/uploads_tmp/1 etc.
      upload_store /tmp/nginxuploads 1;

      # set permissions on the uploaded files
      upload_store_access user:rw group:rw all:r;

      # Set specified fields in request body
      # this puts the original filename, new path+filename and content type in the requests params
      upload_set_form_field $ "$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";
      upload_aggregate_form_field $upload_field_name.size "$upload_file_size";

      upload_pass_form_field ".*";
      upload_cleanup 400 404 499 500-505;

    location /upload_endpoint {

No errors in the logs apart from the 404, and that's just saying the file /usr/local/nginx/html/upload does not exist. Any idea what's going on here?

/tmp/nginxuploads/0 to /tmp/nginxuploads/9 exist and are world readable and writeable.

share|improve this question

It turns out that a GET request to a endpoint setup for the Nginx Upload Module will always return a 404. It works fine with a POST request which is what you want of course, I was just testing using GETs!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.