Upload files from your shell to a public directory

Prerequisites:

Add the following statement to the server directive of your nginx config:

location /folder {
    autoindex on;
}

Replace /folder with the folder you would like to have, relative to the root configuerd in the same server directive.

Now, add the following function to your local shell:

#!/bin/bash
upload(){
    scp -r $@ user@domain.tld:/webserver/root/folder
}

Make sure that user is able to have permissions to write to that folder.

Now you can upload files from your local shell with upload [filename]

If you would like to make sure it won't appear in any search index, add the following to your robots.txt file in the root folder of your webserver:

User-agent: *
Disallow: /folder/*

If you would like it more secure and not allow the user who uploads files to overwrite them and do anything outside the folder, follow these steps:

Index
:wq