I came across this problem using WordPress that I could not upload a GIF file of size around 4Mbytes. The maximum size of file you can upload in WordPress is 2Mbytes by default. In order to change it you will need to do following modifications.
1. You need to change wordpress memory limit by adding the line below to wp-config.php
define(‘WP_MEMORY_LIMIT’, ’8M’);
2. If you are using NginX (which was my case) you need to change maximum body size for client and in order to do that you need to add client_max_body_size 8M; in server { …} section of your config ( /etc/nginx/sites-available/default )
3. You will also have to change the upload_max_filesize = 8M in php.ini ( /etc/php5/cgi/php.ini )
Enjoy the sweetness of WordPress on NginX and beloved Ubuntu.
PS. You will need to restart php-fastcgi and NginX for changes to be applied to your WordPress site.
service php-fastcgi restart
service nginx restart