使用Nginx的Phusion Passenger上的Rails不允许上传大小为>的文件2G

时间:2013-04-08 15:29:05

标签: ruby-on-rails nginx redmine passenger

使用Nginx的Phusion Passenger上的Rails不允许上传大小为>的文件2G。 在上传过程中,我在/ tmp文件夹中得到500错误和一个RackMultipart文件,大小为2G。

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;
    }
  }
}

一切都在没有nginx的情况下有效。当我用应用程序运行mongrel / thin / webrick服务器时。因此,乘客是最新版本,3.0.19,nginx是1.2.6。  怎么了?

2 个答案:

答案 0 :(得分:1)

将client_max_body_size设置为> 2000米。

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

答案 1 :(得分:1)

这是Phusion Passenger中可能存在的错误,在版本4.0.0 RC 4中为solved