Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Requirements

Building

$ apt-get build-dep nginx
$ apt-get source nginx
$ cd nginx/debian/modules
$ git clone https://github.com/vkholodkov/nginx-upload-module
$ cd nginx-upload-module; git checkout 2.2; cd ../
$ git clone https://github.com/cybozu/nginx-uuid4-module
$ cd ../../
$ vi debian/rules

Add the new modules:

--add-module=../nginx-uuid4-module \
--add-module=../nginx-upload-module

Build new .deb:

$ dpkg-buildpackage

Install

$ sudo dpkg -i ../nginx-common_1.10.0-0ubuntu0.16.04.2_all.deb ../nginx-extras_1.10.0-0ubuntu0.16.04.2_amd64.deb 

Configuration

Add an upload endpoint in nginx configuration in /etc/nginx/sites-available/default:

location /upload {
    uuid4 $crash_id;
    upload_store /tmp 1;
    return 200 $crash_id;
}

Testing

Now try uploading a file and ensure that a UUID is returned:

curl -F "key=val" http://localhost/upload/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment