sadfuzzy
sadfuzzy

Reputation: 472

Rails on Phusion Passenger with Nginx not allow uploading files of size > 2G

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?

Upvotes: 0

Views: 1370

Answers (2)

Hongli
Hongli

Reputation: 18924

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

Upvotes: 1

Magnuss
Magnuss

Reputation: 2310

Set the client_max_body_size to > 2000m.

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

Upvotes: 1

Related Questions