即使在 client_max_body_size 100M 之后仍然出现 413 Request Entity Too Large
Still getting 413 Request Entity Too Large even after client_max_body_size 100M
我在 Digital ocean 上使用 Rails 和 Nginx,我一直在尝试上传一个 17.6 MB 的文件,但即使在设置 client_max_body_size 100M
之后我仍然得到 413 Request Entity Too Large
在我的 /etc/nginx/nginx.conf 文件中。
这是文件中的片段:
http {
##
# Basic Settings
##
client_max_body_size 100M;
sendfile on;
tcp_nopush on;
...
}
设置后我使用了 sudo service nginx reload
。当这不起作用时,我什至使用 sudo shutdown -r now
完成了完全重启,然后从我的本地机器上使用 cap production puma:start
。我也试过 client_max_body_size 0;
,据我所知应该完全禁用文件大小检查。什么都不管用。另外,在达到这一点时,我在 client_max_body_size
语句的位置犯了一些错误,在这些情况下服务器无法正确启动并给出 "Something went wrong" 错误,所以我很漂亮确保我所做的更改是针对正确的文件。
有什么我可能遗漏的吗?我还缺少其他地方来配置它吗?我目前配置它的方式是否缺少某些东西?任何指针将不胜感激。
好的。我想通了。根据 how to configure nginx 的 Digital Ocean 指南,我在文件 /etc/nginx/nginx.conf
中设置了 client_max_body_size 100M
。可以肯定的是,改变那里的东西肯定会影响服务器的功能。特别是当我在该文件中弄乱某些东西并且服务器停止运行时。
但是,我忘记了 Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma 是我设置服务器的主要资源,它表明这些参数不是在上面的 nginx.conf
中设置的,而是在我的 rails 应用程序有文件 ~/my_app/config/nginx.conf
其中设置参数已经包含语句
client_max_body_size 10M;
所以我更改了该声明以及 /etc/nginx/nginx.conf
生产文件中的声明。瞧!现在我可以上传最大100M的文件了
我在 Digital ocean 上使用 Rails 和 Nginx,我一直在尝试上传一个 17.6 MB 的文件,但即使在设置 client_max_body_size 100M
之后我仍然得到 413 Request Entity Too Large
在我的 /etc/nginx/nginx.conf 文件中。
这是文件中的片段:
http {
##
# Basic Settings
##
client_max_body_size 100M;
sendfile on;
tcp_nopush on;
...
}
设置后我使用了 sudo service nginx reload
。当这不起作用时,我什至使用 sudo shutdown -r now
完成了完全重启,然后从我的本地机器上使用 cap production puma:start
。我也试过 client_max_body_size 0;
,据我所知应该完全禁用文件大小检查。什么都不管用。另外,在达到这一点时,我在 client_max_body_size
语句的位置犯了一些错误,在这些情况下服务器无法正确启动并给出 "Something went wrong" 错误,所以我很漂亮确保我所做的更改是针对正确的文件。
有什么我可能遗漏的吗?我还缺少其他地方来配置它吗?我目前配置它的方式是否缺少某些东西?任何指针将不胜感激。
好的。我想通了。根据 how to configure nginx 的 Digital Ocean 指南,我在文件 /etc/nginx/nginx.conf
中设置了 client_max_body_size 100M
。可以肯定的是,改变那里的东西肯定会影响服务器的功能。特别是当我在该文件中弄乱某些东西并且服务器停止运行时。
但是,我忘记了 Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma 是我设置服务器的主要资源,它表明这些参数不是在上面的 nginx.conf
中设置的,而是在我的 rails 应用程序有文件 ~/my_app/config/nginx.conf
其中设置参数已经包含语句
client_max_body_size 10M;
所以我更改了该声明以及 /etc/nginx/nginx.conf
生产文件中的声明。瞧!现在我可以上传最大100M的文件了