Ruby on rails Nginx:无法上载文件>;10MB。客户端打算发送太大的正文
我已经使用Ruby on rails Nginx:无法上载文件>;10MB。客户端打算发送太大的正文,ruby-on-rails,nginx,unicorn,Ruby On Rails,Nginx,Unicorn,我已经使用nginx和unicorn在Ubuntu 12.04中部署了我的Rails应用程序 在我的应用程序中,我无法上传大小超过10MB的文件。我检查了nginx错误日志,发现 client intended to send too large body 我在谷歌上找到了一个解决方案,我必须添加client\u max\u body\u size 25M到/etc/nginx/nginx.conf。我这样做了,但它不起作用。请帮忙。下面添加了nginx.conf内容: user www-da
nginx
和unicorn
在Ubuntu 12.04中部署了我的Rails应用程序
在我的应用程序中,我无法上传大小超过10MB的文件。我检查了nginx
错误日志,发现
client intended to send too large body
我在谷歌上找到了一个解决方案,我必须添加client\u max\u body\u size 25M
到/etc/nginx/nginx.conf
。我这样做了,但它不起作用。请帮忙。下面添加了nginx.conf
内容:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 25M;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/xml text/css text/comma-separated-values;
upstream app_server { server 127.0.0.1:8080 fail_timeout=0;}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
在nginx.conf中,在服务器块中添加此行:-- 将此添加到http块中:--
在nginx.conf中,在服务器块中添加此行:-- 将此添加到http块中:--
谢谢你的回答。好的,这个服务器上下文中的其他配置是什么?其他配置意味着它在两个块中已经有一些其他设置,应该保持原样,或者您可以相应地进行自定义。但是我的
nginx.conf
没有任何server
上下文。我该做什么请帮忙。谢谢你的回答。好的,这个服务器上下文中的其他配置是什么?其他配置意味着它在两个块中已经有一些其他设置,应该保持原样,或者您可以相应地进行自定义。但是我的nginx.conf
没有任何server
上下文。我该怎么办请帮忙。这个问题似乎属于Stack Exchange网络中的另一个站点,因为它与编程无关。或者。这个问题似乎属于Stack Exchange网络中的另一个站点,因为它与编程无关。也许是。
http {
#other configuration
server {
#other configuration
client_max_body_size 25M;
}
}
server {
listen 80;
client_max_body_size 25M;
server_name localurl.me;
index index.html index.htm;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_pass http://0.0.0.0:3000;
}
}