Search
Close this search box.

Increasing File Upload Size in NGINX and PHP

I needed to increase the file upload size for a project, so here’s how I did it for both PHP and NGINX.

PHP Configuration:

  1. Find your php.ini file:
    “`bash
    php --ini
  2. Edit it using vim:
    “`bash
    upload_max_filesize = 100M
    post_max_size = 100M

    “`

    <div class="flex items-center rounded bg-token-main-surface-secondary px-2 font-sans text-xs text-token-text-secondary"><code></code></div>
    </div>
    </div>
    </div></li>
    </ol>

    <h3>NGINX Configuration:</h3>

    <ol>
    <li>In your <code>nginx.conf</code>, add:
    <div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
    <div class="flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9">“`bash

    client_max_body_size 100m;
    ```

    <div class="overflow-y-auto p-4" dir="ltr"><code></code></div>
    </div></li>
    <li>Reload services:
    <div class="dark bg-gray-950 contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative">
    <div class="flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9">“`bash

    sudo service nginx reload
    sudo service php-fpm reload
    “`
Share this Post:
Scroll to Top