When you have a PHP-based website like WordPress running on NGINX, you would typically change the maximum file upload size in PHP settings e.g., in php.ini
file or similar.
NGINX web server has it’s own configuration where you can set the max upload size server-wide. This is set in the .conf
file using the client_max_body_size
directive.
To set the maximum upload site server-wide (for all sites on the server)
Find the NGINX config file which is usually located at /etc/nginx/nginx.conf
. Open the file and set the directive in the http
block.
|
|
To set the maximum upload site for a particular site running on the server
Find the site’s config file which is usually located at /etc/nginx/sites-enabled/website-name.conf
or /etc/nginx/conf.d/website-name.conf
. Open the file and set the directive in the server
block.
|
|
To set the maximum upload site for a particular folder on the server
You can set this in the site’s config file. Open the .conf
file and set the directive in the location
block. The folder needs to exist under the website’s folder. In this example, the folder /uploads
needs to exist.
|
|
Restart NGINX
Make sure to restart NGINX after setting any of these options by running
|
|