0

Rails on Phusion Passenger with Nginx not allow uploading files of size > 2G. During upload I get 500 error and a RackMultipart file in /tmp folder of size 2G exactly.

nginx.conf:

worker_processes 2;
timer_resolution 100ms;
worker_priority -5;

error_log /opt/vhod/webapp/shared/log/nginx_error.log;
pid /var/run/nginx.pid;

events {
  worker_connections 1024;
}

http {
 passenger_root /home/vhod-admin/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/passenger-3.0.19;
 passenger_ruby /home/vhod-admin/.rbenv/versions/1.8.7-p370/bin/ruby;
 passenger_max_pool_size   3;
 passenger_pool_idle_time  1200;

 passenger_spawn_method          smart;
 passenger_friendly_error_pages  on;
 passenger_log_level             1;
 passenger_debug_log_file        /opt/vhod/webapp/shared/log/passenger_debug.log;
 include       mime.types;
 default_type  application/octet-stream;

 sendfile              on;
 client_max_body_size  0;

 proxy_max_temp_file_size  0;
 proxy_read_timeout        360s;
 keepalive_timeout         70;

 server {
    listen        443;
    server_name   vhod;
    charset       utf-8;

    root /opt/vhod/webapp/current/redmine/public;
    passenger_enabled           on;
    passenger_use_global_queue  on;
    passenger_min_instances     1;
    rails_env                   production;

    ssl                 on;
    ssl_certificate     cert.pem;
    ssl_certificate_key cert.key;
    ssl_protocols       SSLv3 TLSv1;

    if (-f /opt/vhod/webapp/shared/system/maintenance.html) {
        rewrite ^(.*)$ /opt/vhod/webapp/shared/system/maintenance.html last;
        break;
    }
  }
}

Everything works only without nginx. When i run mongrel/thin/webrick server with the application. So, the passenger is the latest version, 3.0.19, nginx is 1.2.6. What's the matter?

2 Answers 2

1

This is a possible bug in Phusion Passenger, which has been solved in version 4.0.0 RC 4.

0
1

Set the client_max_body_size to > 2000m.

http://wiki.nginx.org/HttpCoreModule#client_max_body_size

1
  • This (client_max_body_size 8000m;) did not solve the problem :( still "Status: 500 Internal Server Error, bad content body" /opt/vhod/webapp/releases/20130408122834/redmine/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/utils.rb:572:in `parse_multipart'
    – sadfuzzy
    Apr 9, 2013 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.