Its fixed.

We were using a Javascript to submit the form that held the file
field. When we used a submit button instead of the javascript, it all
started working properly. I wonder whats wrong internally but for now,
the code is working :-). If you are doing something similar, make sure
you use a submit button instead of a Javascript that submits the form.

Chirantan

On Nov 20, 10:02 am, Chirantan <[EMAIL PROTECTED]> wrote:
> Hi,
> I am using mongrel with nginx and I am facing problem when I try to
> upload a large file. After googling about this, I came to know that I
> need to configure nginx.conf file by setting 'client_max_body_size'
> to
> a value of desired maximum file size. I did that but still it does
> not
> seem to work. Files above 200 KB do not get uploaded. I also get a
> weird error about sockets (Given below the nginx.conf file)
> What am I doing wrong? Please help.
>
> My nginx.conf lokos like this:
>
> user  postgres ;
> worker_processes  2;
> error_log  /var/www/webapps/FileSharing/log/error.log notice;
> pid        /var/www/webapps/FileSharing/log/nginx.pid;
> events {
>     worker_connections  1024;
>
> }
>
> http {
>     include       mime.types;
>     default_type  application/octet-stream;
>     # no sendfile on OSX uncomment
>     #this if your on linux or bsd
>     #sendfile        on;
>     tcp_nopush     on;
>     keepalive_timeout  65;
>     tcp_nodelay        on;
>     upstream mongrel {
>         server 127.0.0.1:4000;
>         server 127.0.0.1:4001;
>         server 127.0.0.1:4002;
>     }
>     gzip on;
>     gzip_min_length  1100;
>     gzip_buffers     4 8k;
>     gzip_types       text/plain;
>     server {
>         listen       80;
>         server_name  something.com;
>         access_log /var/www/webapps/FileSharing/log/access.log;
>         error_log /var/www/webapps/FileSharing/log/error.log;
>         root /var/www/webapps/FileSharing/public;
>         access_log  on;
>         rewrite_log on;
>          #client_max_body_size 1048576k;
>          client_max_body_size 1024M;
>          client_body_buffer_size 512k;
>         client_header_buffer_size 1048576k;
>         location /ui
>        {
>           root /var/www/webapps/FileSharing/public;
>         }
>         location ~ ^/$ {
>           if (-f /index.html){
>             rewrite (.*) /index.html last;
>           }
>            proxy_pass  http://mongrel;
>         }
>         location / {
>           if (!-f $request_filename.html) {
>             proxy_pass  http://mongrel;
>           }
>           rewrite (.*) $1.html last;
>         }
>         location ~ .html {
>            root /Users/ez/nginx/public;
>         }
>         location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|
> bz2|
> doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
>           access_log  off;
>           expires      30d;
>         }
>       location / {
>          # needed to forward user's IP address to rails
>          proxy_set_header  X-Real-IP  $remote_addr;
>          # needed for HTTPS
>         #proxy_set_header X_FORWARDED_PROTO https;
>         #proxy_set_header  X-Forwarded-For
> $proxy_add_x_forwarded_for;
>         proxy_set_header Host $http_host;
>         proxy_redirect false;
>         #proxy_max_temp_file_size 1048576k;
>         proxy_max_temp_file_size 1024M;
>         # If the file exists as a static file serve it directly
> without
>         # running all the other rewite tests on it
>         if (-f $request_filename) {
>           break;
>         }
>        # this is the meat of the rails page caching config
>        # it adds .html to the end of the url and then checks
>        # the filesystem for that file. If it exists, then we
>        # rewite the url to have explicit .html on the end
>        # and then send it on its way to the next config rule.
>        # if there is no file on the fs then it sets all the
>        # necessary headers and proxies to our upstream mongrels
>        if (-f $request_filename.html) {
>         rewrite (.*) $1.html break;
>       }
>       if (!-f $request_filename) {
>         proxy_passhttp://mongrel;
>         break;
>       }
>      error_page   500 502 503 504  /500.html;
>     location = /500.html {
>       root   /var/www/webapps/FileSharing/public;
>     }
>     }
>     }
>
> }
>
> Error:
>
> Thu Nov 20 10:47:37 +0530 2008: Error reading HTTP body:
> #<RuntimeError: Socket read returned insufficient data: 5672>
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> http_request.rb:107:in `read_socket'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> http_request.rb:77:in `read_body'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> http_request.rb:55:in `initialize'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 149:in `new'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 149:in `process_client'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 285:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 285:in `initialize'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 285:in `new'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 285:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 268:in `initialize'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 268:in `new'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/
> mongrel.rb:
> 268:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> configurator.rb:282:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> configurator.rb:281:in `each'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> configurator.rb:281:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:
> 128:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/
> command.rb:212:in `run'
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
> /usr/local/bin/mongrel_rails:19:in `load'
> /usr/local/bin/mongrel_rails:19
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to