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 weight=10 max_fails=3;
server 4dc1.domain.com:8081 weight=10 max_fails=3;
server 4dc2.domain.com:8080 weight=10 max_fails=3;
server 4dc2.domain.com:8081 weight=10 max_fails=3;
}
server {
listen 80;
listen 8080;
server_name domain.com 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
I keep getting 405 Not allowed error.
How can I get jQuery-File-Upload and nginx to work together?
Thanks.
Posted at Nginx Forum: