# jQuery-File-upload and nginx

**URL:** <https://www.ruby-forum.com/t/jquery-file-upload-and-nginx/222412>\
**Category:** NGINX\
**Created:** [August 27, 2012, 11:42pm UTC](https://www.ruby-forum.com/t/jquery-file-upload-and-nginx/222412 "2012-08-27T23:42:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 27, 2012, 11:42pm UTC](https://www.ruby-forum.com/t/jquery-file-upload-and-nginx/222412/1 "2012-08-27T23:42:52Z")

</div>

I have a problem setting up jQuery-File-Upload plugin and nginx. I’ve  
downloaded and installed nginx 1.2.3, and upload module 2.2.0 from  
source,  
here’s my config file (names have been changed to protect the innocent):  
upstream web\_backend {  
server [4dc1.domain.com:8080](http://4dc1.domain.com:8080) weight=10 max\_fails=3;  
server [4dc1.domain.com:8081](http://4dc1.domain.com:8081) weight=10 max\_fails=3;  
server [4dc2.domain.com:8080](http://4dc2.domain.com:8080) weight=10 max\_fails=3;  
server [4dc2.domain.com:8081](http://4dc2.domain.com:8081) weight=10 max\_fails=3;  
}

server {  
listen 80;  
listen 8080;  
server\_name [domain.com](http://domain.com) [www.domain.com](http://www.domain.com);  
error\_log  
/var/www/vhosts/domain.com/statistics/logs/error\_log.nginx warn;  
access\_log  
/var/www/vhosts/domain.com/statistics/logs/access\_log.nginx main  
buffer=32k;  
root /var/www/vhosts/domain.com/httpdocs/website;

# auth\_basic “Restricted”;

# auth\_basic\_user\_file .htpasswd;

```
    index index.html;

    location / {
            expires 7d;
    }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;

    location = /50x.html {
            root /var/www/vhosts/domain.com/httpdocs/website;
    }

    location = /404.html {
            root /var/www/vhosts/domain.com/httpdocs/website;
    }

    location /img/ {

```

# auth\_basic off;

```
            expires 10m;
    }

    location ~*

```

^.+.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|ico|swf|mov)$  
{  
expires 7d;  
}

```
    location /jsonrpc/ {
            proxy_pass http://web_backend$request_uri;
            include /etc/nginx/proxy.conf;
    }

    location /upload/ {
            upload_pass @test;

            upload_store /path/to/file/store/ 1;
            upload_store_access user:rw group:rw;

            upload_set_form_field $upload_field_name.name

```

“$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.md5"

```

“$upload\_file\_md5”;  
upload\_aggregate\_form\_field “$upload\_field\_name.size”  
“$upload\_file\_size”;

```
            upload_pass_form_field "^submit$ | ^description$";
            upload_cleanup 400 404 499 500-505;
    }

   location @test {
           proxy_pass http://localhost:8080;
   }

```

}

The html file contains a form with method set to “POST”, hence the  
upload  
module. Here’s the relevant bits of the html file:

  

  
  
  
   
 Add files…  
   
   
  
  
Start upload  
  
  
  
Cancel upload  
  
  
  
Delete  
  
  

  
  

  
  

  

  

  
  

&nbsp;
  

  

  
  

  
  
  
  

  

I keep getting 405 Not allowed error.  
How can I get jQuery-File-Upload and nginx to work together?  
Thanks.

Posted at Nginx Forum:

> **[jQuery-File-upload and nginx](https://forum.nginx.org/read.php?2,230157,230157#msg-230157)**
>
> I have a problem setting up jQuery-File-Upload plugin and nginx. I've downloaded and installed nginx 1.2.3, and upload module 2.2.0 from source, here's my config file (names have been changed to protect the innocent): upstream web\_backend { server...
