image upload to server does not work

Posted May 16, 2017 18.5k views
NginxMySQLPHPUbuntu 16.04

I’m using in my app intervention image library from , its working very good on my localhost (pc) but image upload didn’t work on digital ocean server ! , so anyone have any idea why this problem happens to me 

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
8 answers


What’s the output of of the following command? If you’ll post this to a code block using the </> icon, that’ll help keep the original formatting.

tail -50 /var/log/nginx/error.log

Looking beyond that, is the Droplet configured identically to your local environment?

take a look at destination directory’s write permission

2017/05/15 21:47:43 [notice] 11790#11790: signal process started
2017/05/15 23:28:10 [notice] 1721#1721: signal process started
2017/05/16 09:02:06 [error] 1724#1724: *144 client intended to send too large body: 1214882 bytes, client:, ser ver:, request: “POST /profile/5 HTTP/1.1”, host: “”, referrer: “

what is that means ?

  • @samehfrehat

    You’re trying to upload a file larger than what is allowed by Nginx - and PHP also has similar configuration.
    Here’s an example of allowing 100 MB uploads.

    Edit /etc/nginx/nginx.conf. Find/add this line to the http block and restart Nginx:

    client_max_body_size 100m;

    Edit /etc/php/7.0/fpm/php.ini. Modify these parameters and restart PHP-FPM:

    upload_max_filesize = 100M
    post_max_size = 100M

@yokotobe i tried every thing about permissions , it does not work !

i do change these parameters , but nothing changes , i will try again
if i replace the nginx with apache do you think its gonna work correctly ?

  • @samehfrehat I’m not sure what the default Apache body size is set to, but my guess it’s also limited to 1-2 MB by default.

    Did you restart Nginx and PHP-FPM?

    sudo service nginx restart
    sudo service php7.0-fpm restart

    And are you sure, you don’t have the parameters listed in other files, which overwrites the ones you’ve just set.

    In Nginx it could be in any file included (look for parameter include) in the main configuration file /etc/nginx/nginx.conf. Search for it:

    sudo grep -r "client_max_body_size" /etc/nginx/

    In PHP-FPM it could be in any file within /etc/php/. Search for it:

    sudo grep -r "upload_max_filesize" /etc/php/
    sudo grep -r "post_max_size" /etc/php/

i do every single command you mentions ! but it still not works !
im using image library , and stores the images inside the public/images
folder , i give the permissions for this folder sudo chmod -R 775 /var/www/laravel/public/images ,
anyway thank you very much for help @hansen

  • So when you run the search commands (grep), it show this - and only this?

    sudo grep -r "client_max_body_size" /etc/nginx/
      /etc/nginx/nginx.conf:client_max_body_size 100m;
    sudo grep -r "upload_max_filesize" /etc/php/
      /etc/php/7.0/fpm/php.ini:upload_max_filesize = 100M
      /etc/php/7.0/cli/php.ini:upload_max_filesize = 2M
    sudo grep -r "post_max_size" /etc/php/
      /etc/php/7.0/fpm/php.ini:post_max_size = 100M
      /etc/php/7.0/cli/php.ini:post_max_size = 8M

    If yes, then I’m guessing Laravel is setting a configuration somewhere, but then try giving Apache a spin if you feel like it.

yes it looks exactly like this but i changed these two lines
/etc/php/7.0/cli/php.ini:uploadmaxfilesize = 2M ,, to 100m
/etc/php/7.0/cli/php.ini:postmaxsize = 8M ,, to 100m

try to reboot server, not just restart the service.... that will be work as well.