7

There are a lot of answers to this problem (question 1 question 2) but this solution that should work, doesn't work for me:

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
        client_max_body_size 50M;

I have checked the status and contents of this created file via ssh and its correct. I also have tried other values and restarted the server multiple times.

client_max_body_size 0;

or

http {
   client_max_body_size 50M;
}

This values do not work either.

it just wont work, even with "just" a 6mb image. it work with smaller images around size of 0.5mb. It's a RoR app with "64bit Amazon Linux 2018.03 v2.8.0 running Ruby 2.5 (Puma)". The instance size is t2.micro.

antpaw
  • 15,444
  • 11
  • 59
  • 88
  • Can you post the output of `nginx -T` on your EBS machine? – Tarun Lalwani May 29 '18 at 08:07
  • @TarunLalwani https://pastebin.com/25kmG4Bb here you go – antpaw May 29 '18 at 09:29
  • The config seems to applied, can you reload the nginx service through SSH and see if that helps. Also can you show the error logs of nginx – Tarun Lalwani May 29 '18 at 09:40
  • i have restarted the servers via ebs web console and even rebuild the entire environment, multiple times, the error.log doesn't show any problems regarding this issue. maybe its because this ebs env lives behind a cloudfront cdn? – antpaw May 29 '18 at 11:10
  • That's a important details missing from the question as such. But looking at the limits https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-general it should still be in safe zone – Tarun Lalwani May 29 '18 at 11:15
  • Are you sure that your conf file is being loaded? The Passenger platform does not - I had to add `include /etc/nginx/conf.d/*.conf;` to `/opt/elasticbeanstalk/support/conf/nginx_config_healthd.erb`. The Puma platform might be different, however. – Brian May 29 '18 at 15:45
  • yes i tried to add a syntax error to the file and the system said it wont load it. maybe the nignx is not restarting if you restart from the ebs web console – antpaw May 29 '18 at 17:00

1 Answers1

6

Try this. It worked for me:

content: |
    server {
        ***your server configuration***

        location / {
             client_max_body_size 100M;
        }
    }
Nipun Chawla
  • 356
  • 2
  • 8
  • 3
    While this may be the answer, please add additional detail and explanation of why it is the answer. – static_cast Jan 18 '19 at 13:23
  • Here are some sample configs, among which is also one with `client_max_body_size ` in it. Hope it helps give some context. https://gist.github.com/nateware/3988974 – Tum Dec 10 '20 at 09:56