简体   繁体   中英

Server Error 500 when uploading image

I am trying to solve a problem with uploading images.

I have set the error.log for Nginx to info.

First when I'm trying to upload, I get 413 Request Entity Too Large . In error.log it says

client intended to send too large body: 2524917 bytes, client: my.client.public.ip, server: my.server.public.ip, request: "POST /admin/part/part/7/change/ HTTP/1.1", host: "my.domain.se", referrer: " http://my.domain.se/admin/part/part/7/change/ "

So I add this line in my config for Nginx client_max_body_size 50M; and restart Nginx. When trying to upload again I get Server Error (500) with this line in error.log

a client request body is buffered to a temporary file /var/lib/nginx/body/0000000001, client: my.client.public.ip, server: my.server.public.ip, request: "POST /admin/part/part/7/change/ HTTP/1.1", host: "my.domain.se", referrer: " http://my.domain.se/admin/part/part/7/change/ "

Can't seem to find any answer when searching the internets.

How typical is it to figure out the answer after posting the question?

For others who might encounter this. Check the permissions for the folder where the files are being uploaded to.

I had only the user for Nginx set with permisisons to media folder.

Of course the user for my django project needs the permission to write as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM