502 Bad Gateway when an image is uploaded

Hi friends,

when I tried to upload an image it gives 502 Bad gateway error. My website failed to load for 5 minutes. When I tried to upload the same image here, I got following message

Sorry, the image you are trying to upload is too large (maximum dimension is 40-megapixels), please resize it and try again.

Why I am getting a bad gateway error. My server is an aws ec2 instance with 1 GB ram. I use cloudflare cdn as well.

Here is error log:

The last warning in the log keep reappear since first install.


The web application worker is probably crashing trying to accept such a huge file, given you’ve only got 1GB of RAM (and probably no swap). Try having more memory, or not uploading such oversized media.


I have enabled 2 GB swap during the installation. How much is Discourse recommended RAM size? This may cause trouble in future if any of my user upload any over-sized image. Could you please comment on the last line in error log image, Its keep coming back.

What version are you running, when did you last rebuild?

1 Like