Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ruby-on-rails-3 – “413请求实体太大”错误路径3.2乘客Phusion大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个rails应用程序使用Rails 3.2.3,Ruby 1.9.3和Phusion乘客与Nginx模块. App用户需要上传大文件.我添加了指令client_max_body_size 500M;到nginx.conf(下面)的位置块,并通过使用Ctrl-C停止并启动nginx,以停止nginx,乘客开始重新启动nginx.但是,当我尝试上传一个127 mb的文件时,我收到错误“413 request Entity Too Large”.有人可以让我知道我忽视了什么吗?

谢谢,

我的nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    passenger_root /Users/mcmahling/.rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.12;
    passenger_ruby /Users/mcmahling/.rvm/wrappers/ruby-1.9.3-p125/ruby;
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forWARDed_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  165;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        client_max_body_size       4G;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        LOCATIOn / {
             root   html;
             index  index.html index.htm;
             client_max_body_size       4G;
                       clienT_Body_buffer_size    128k;
             clienT_Body_temp_path      /usr/local/nginx/clienT_Body_temp;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        LOCATIOn = /50x.html {
            root   html;
        }

        # proxy the php scripts to Apache listening on 127.0.0.1:80
        #
        #LOCATIOn ~ \.php${
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the php scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #LOCATIOn ~ \.php${
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILename  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files,if Apache's document root
        # concurs with nginx's one
        #
        #LOCATIOn ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-,name-,and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    LOCATIOn / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # httpS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    LOCATIOn / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

解决方法

更改client_max_body_size 4G;至4g;或500m; insde的服务器块

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails-3 – “413请求实体太大”错误路径3.2乘客Phusion全部内容,希望文章能够帮你解决ruby-on-rails-3 – “413请求实体太大”错误路径3.2乘客Phusion所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。