This is How to Increase Upload File Size More Than 1 MB on Nginx and WordPress
As a WordPress developer or website owner, you may have encountered the frustrating issue of being unable to upload files larger than 1 MB on your Nginx-powered WordPress website. This can be a significant problem if you need to upload high-resolution images, videos, or other large media files.
Fortunately, there are several steps you can take to increase the maximum upload file size on your WordPress website running on an Nginx server. In this blog post, we'll dive into the details and provide you with a comprehensive guide to solve this common problem.
Understanding the Default Upload File Size Limitations
WordPress, by default, sets the maximum upload file size to 2 MB. However, this limit can be further restricted by your web server's configuration, such as Nginx.
Nginx, a popular and efficient web server, has its own set of default file upload size limitations. Nginx's default maximum upload file size is set to 1 MB. This means that even if you've configured WordPress to allow larger file uploads, the Nginx server may still be blocking them.
Step 1: Modify the Nginx Configuration
To increase the maximum upload file size on your Nginx-powered WordPress website, you'll need to update the Nginx configuration. Follow these steps:
- Open your Nginx configuration file, usually located at
/etc/nginx/nginx.conf
or /etc/nginx/conf.d/your-site.conf
.
- Find the
http
or server
block that contains the WordPress configuration.
- Add the following lines inside the block:
client_max_body_size 20M; # Set the maximum upload file size to 20 MB
In this example, we've set the maximum upload file size to 20 MB. You can adjust this value to suit your needs.
- Save the configuration file and restart the Nginx service.
Step 2: Modify the PHP Configuration
In addition to the Nginx configuration, you'll also need to update the PHP configuration to ensure that it aligns with the increased upload file size.
- Open your PHP configuration file, usually located at
/etc/php/7.x/fpm/php.ini
or /etc/php.ini
.
- Find the following settings and update them accordingly:
upload_max_filesize = 20M # Set the maximum upload file size to 20 MB
post_max_size = 20M # Set the maximum post size to 20 MB
memory_limit = 256M # Set the maximum memory limit to 256 MB
- Save the configuration file and restart the PHP-FPM service.
Step 3: Verify the Changes in WordPress
After making the Nginx and PHP configuration changes, you'll need to verify that the changes have been applied correctly in your WordPress website.
- Log in to your WordPress admin dashboard.
- Go to
Media > Add New
and try uploading a file larger than the previous 1 MB limit.
- If the upload is successful, the changes have been applied correctly.
If you're using a WordPress multisite, there's an additional step you need to take:
- Go to the Network Admin dashboard.
- Navigate to
Settings > Network Settings
.
- In the "Upload Settings" section, ensure that the "Maximum upload file size" field is set to a value higher than the one you've configured in the Nginx and PHP settings.
Troubleshooting Tips
If you're still experiencing issues with uploading larger files, here are some additional troubleshooting tips:
-
Check for WordPress plugin conflicts: Some WordPress plugins may override the upload file size settings. Deactivate any plugins that may be interfering with the upload process and try uploading the file again.
-
Verify the file permissions: Ensure that the directory where the files are being uploaded has the correct permissions. The directory should be writable by the web server user (usually www-data
or nginx
).
-
Check the error logs: Review the Nginx and PHP error logs for any relevant error messages that could help you identify the root cause of the issue.
-
Consider using a dedicated file hosting service: If you frequently need to upload large files, you may want to consider using a dedicated file hosting service, such as Amazon S3 or Google Cloud Storage, to handle your file uploads.
By following these steps, you should be able to successfully increase the maximum upload file size on your Nginx-powered WordPress website, allowing you to upload larger files without any issues.
Flowpoint.ai can help you identify any technical errors that may be impacting your website's conversion rates, and provide AI-generated recommendations to fix them, ensuring your users have a seamless experience when uploading files.
Get a Free AI Website Audit
Automatically identify UX and content issues affecting your conversion rates with Flowpoint's comprehensive AI-driven website audit.