Hello everyone, I am Brother Lei Feng. Recently, Brother Lei Feng helped someone build a website that required uploading large video files. WordPress's media file upload limit is typically within 50M, which depends on your installed environment configuration.

After searching online for tutorials, many are incorrect. Some even suggest adding @ini_set( 'upload_max_size' , '64M' ); in functions.php, which is actually useless. The most correct method is to modify the php.ini file + the configuration files for nginx / Apache. Below, I'll explain how to modify them.
# Connect to the VPS server using SSH software # Reference tutorial:#WebsiteBuilding# Xshell 6 Basic Tutorial: Connecting to VPSIf you are not comfortable modifying files directly via ssh, you can also usexftpthese software to download the file to your local machine, modify it, and then upload it to the server to overwrite the original.Modify upload file size via php.ini
Step 1:Enter php -i | grep 'php.ini'Step 2:Copy the obtained php.ini pathStep 3:Enter sudo gedit /usr/local/php/etc/php.ini (or use your preferred editor, such as vim)Step 4:Search for the value after upload_max_filesize and change it to = 5000M (here I changed it to 5G)Step Five:Search for the value after post_max_size and change it to = 5000M (here I changed it to 5G)Step Six:SaveModify upload file size via nginx
Step 1:Enter sudo gedit /usr/local/nginx/conf/vhost/www.yourdomain.conf (or use your preferred editor, such as vim) Note: Your website's configuration file may not be in the location above, please modify the command path according to your actual situation.Step Two: In the opened .conf file, add the following content, then save.location ~ .php$ {
client_max_body_size 5000M;
}Step Three: Reload the nginx configuration or restart nginx to make it effective.Modify upload file size via Apache
Open the .htaccess file in the website root directory and add the following content:php_value upload_max_filesize 5000M php_value post_max_size 5000MThen save, and you can increase the attachment upload size.
Increase/Modify WP upload file size via Baota Panel
# Baota Panel Installation Tutorial:Beginner-friendly graphic installation tutorial for building a website with Baota Panel Step 1:Software Store → Installed → php → Settings → Configuration Modification, change Post_max_size and upload_max_filesize to your required upload capacity size.
Step 2:Taking nginx as an example, open Software Store → Installed → nginx → Settings → Performance Tuning, find Client_max_body_size and change it to your required upload capacity size.
Finally, you need to restart PHP and nginx / Apache for it to take effect.Multisite WordPress Settings
If you are usingWordPress MultisiteAfter the above settings, you also need to log in as a Super Admin → Settings → Network Settings, find „Upload Settings“, and set the attachment size separately there.
The above is the correct method to increase the upload attachment size for WordPress. If not necessary, it's better not to set the upload attachment size too large to avoid affecting performance due to uploading overly large attachments. If you need to upload temporarily, you can use FTP.
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.