Upload file to Nginx with cURL

Asked by At

All,

I'm trying to upload a local file to my remote Nginx server via cURL. I have built Nginx from source with the upload module and the DAV module. At the bottom of the Nginx page, there is an example form to upload a file. I'm not sure how I would implement the form, and (several) Google searches have returned little helpful information about uploading directly to Nginx via cURL.

Current tech stack:

  • Nginx
  • Green Unicorn
  • Flask

Of all the different avenues I've tried, the following is the one that seems the most appropriate for the task.

curl -X POST -F "[email protected]" http://54.226.64.199/upload

However, the response is underwhelming.

I've tried --uploade-file as well, the response is a 405. From what I've read, upload only accepts a POST command, not PUT, hence why I get a 405.

I don't need a full solution (would be great!), only pointing in the right direction.

Any help is appreciated. Thanks

EDIT: sorry wanted to include part of my .conf

        location /upload {
        upload_store /tmp;
        #upload_pass @none;
        upload_store_access all:rw;
        upload_cleanup 400 404 499 500-505;

    }

0 Answers