1

I am trying to increase the upload limit on my PHP application to 512MB by changing the nginx.conf as follows -

#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 512M;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  6500;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

    include /etc/nginx/conf.d/*.conf;
}

But however it still seems to be capped at 120MB

Can someone please help make changes to accept files beyond 120mb

Thank you..

VMN
  • 181
  • 1
  • 2
  • 14
  • Well this is the part of the server, now if you want to upload trough php you must increase the limit too (in php.ini) see http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size ... do not forget to restart nginx ;) – Xavjer Nov 27 '14 at 10:57
  • Yes, I have changed that too via .htaccess as follows - php_value max_execution_time 600 php_value upload_max_filesize 512M php_value post_max_size 512M php_value memory_limit 512M Also any difference between reload and restart of nginx ? – VMN Nov 27 '14 at 11:03
  • Reload refreshes the settings, restart does completely terminate the webserver and it will not be available for a moment, i think with reload this should not happen. Did you allow your .htaccess to overwrite the php.ini? This post is about this: http://stackoverflow.com/questions/7841709/how-to-prevent-override-the-setting-using-htaccess-or-custom-php-ini – Xavjer Nov 27 '14 at 11:12
  • I just verified with phpinfo(); The new values are reflecting. – VMN Nov 27 '14 at 11:15
  • Just found this post: https://rtcamp.com/tutorials/php/increase-file-upload-size-limit/ you may need to increase the timeout limit too and you could try reloading php5-fpm as well as nginx – Xavjer Nov 27 '14 at 11:19
  • You may need to add the max to your server and location too (in addition to http) check: http://stackoverflow.com/questions/2056124/nginx-client-max-body-size-has-no-effect – Xavjer Nov 27 '14 at 11:22
  • I have done that.. php_value max_execution_time 600 keepalive_timeout 6500; Maybe 600 is not sufficient.. – VMN Nov 27 '14 at 11:25
  • This is for php.ini, i referenced the timeout limit of nginx client_body_timeout 600s; – Xavjer Nov 27 '14 at 11:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65754/discussion-between-vmn-and-xavjer). – VMN Nov 27 '14 at 11:31

1 Answers1

3

Look at your php.ini file:

; Maximum allowed size for uploaded files.
upload_max_filesize = 512M

; Must be greater than or equal to upload_max_filesize
post_max_size = 512M

it will need to match your nginx config

Ryan
  • 81
  • 3