Edit /etc/nginx/sites-enabled/default:

 location ^~ /upload/ { 
    location ~ .*\.(php)?$ 
    { 
      deny all; 
    } 
    location ~ .*\.(py)?$ 
    { 
      deny all; 
    }
    location ~ .*\.(rb)?$ 
    { 
      deny all; 
    }
    # .... etc 
 }

Where ‘upload’ is in the web root directory.

Then:

sudo service nginx restart
Advertisement