【发布时间】:2014-05-09 01:03:43
【问题描述】:
我在 Ubuntu 12.04 中使用 nginx 和 unicorn 部署了我的 Rails 应用程序。
在我的应用程序中,我无法上传大小超过 10MB 的文件。我检查了nginx错误日志,发现
client intended to send too large body
我用谷歌搜索了一个解决方案,我必须将client_max_body_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/*;
}
【问题讨论】:
-
这个问题似乎属于 Stack Exchange 网络中的另一个站点,因为它与编程无关。也许Super User 或Server Fault。
标签: ruby-on-rails nginx unicorn