如何解决 Nginx 和 Amazon ElasticBeanstalk 中的错误 413 Request Entity Too Large?
How to resolve error 413 Request Entity Too Large in Nginx and Amazon ElasticBeanstalk?
我在我的项目中上传大图片时遇到问题,我的配置是使用 puma 和 RoR。我在elasticbeanstalk中的用户是ec2-user.
我已经尝试了很多我看到的配置,但都无法正常工作。 .ebextensions 中的文件如下所示:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000777"
owner: root
group: root
content: |
client_max_body_size 4G;
其他配置但不起作用
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
client_max_body_size 50M;
文件已创建但未成功。有什么建议么?谢谢
我已经解决了我的问题,我必须在 http
中添加:client_max_body_size
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
http {
client_max_body_size 20M;
}
我已经用这个文件解决了这个问题:.ebextensions/01_files.config
container_commands:
01_reload_nginx:
command: "service nginx reload"
files:
"/etc/nginx/conf.d/proxy.conf":
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 0;
我在我的项目中上传大图片时遇到问题,我的配置是使用 puma 和 RoR。我在elasticbeanstalk中的用户是ec2-user.
我已经尝试了很多我看到的配置,但都无法正常工作。 .ebextensions 中的文件如下所示:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000777"
owner: root
group: root
content: |
client_max_body_size 4G;
其他配置但不起作用
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: ec2-user
group: ec2-user
content: |
client_max_body_size 50M;
文件已创建但未成功。有什么建议么?谢谢
我已经解决了我的问题,我必须在 http
中添加:client_max_body_sizefiles:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
http {
client_max_body_size 20M;
}
我已经用这个文件解决了这个问题:.ebextensions/01_files.config
container_commands:
01_reload_nginx:
command: "service nginx reload"
files:
"/etc/nginx/conf.d/proxy.conf":
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 0;