"413 request entity too large" in nginx with "client_max_body_size" set

Ever tried uploading a tệp tin to lớn WordPress only lớn see the 413 Request Entity Too Large error pop up? Annoying, right? Well don’t worry, we have sầu a solution! In this article, we will teach you how khổng lồ fix the 413 Request Entity Too Large error in WordPress.

Bạn đang xem: "413 request entity too large" in nginx with "client_max_body_size" set

What 413 Request Entity Too Large Error Means?

In short, the 413 Request Entity Too Large error happens when you try uploading a tệp tin too large for your hệ thống. Typically, hosting providers have specific configurations on their hệ thống for uploading truyền thông khổng lồ WordPress. In most cases, the mặc định settings are more than enough for your posts.

However, in some cases, you might need lớn upload a file that exceeds the kích cỡ limit, and you will, unfortunately, face the 413 error.

How to Fix 413 Request Entity Too Large Error in WordPress

Luckily, there are quite a few ways to lớn fix this issue. We will teach you three different methods of how lớn khuyến mãi with the error on WordPress.
Important: Two of the methods khuyễn mãi giảm giá with important WordPress files, so we strongly suggest you baông xã up your files before starting any configuration.


1. Modifying the functions.php file

You can find the functions.php file in your WordPress themes thư mục. This file is often used to define ‘classes’ & ‘actions’ on your WordPress site. It can add features và functionality like enabling post thumbnails, post formats, and navigation menus.

To modify functions.php access your hostingvietnam.vn Control Panel. Then, go to the File Manager under the Files section.

Xem thêm: Tổng Hợp Các Plugin Hay Cho Wordpress & Top 10 Plugins Nên Sử Dụng

*
*
*
*
*
*

Make sure you save the modification and cthất bại the window. Go baông chồng to lớn WordPress admin area & try upload a new.

3. Modifying Nginx Configuration

If you use a hostingvietnam.vn VPS VPS, you’ll get control over most of your hệ thống environment. We only reach basic VPS software (Apabịt or Nginx) in its default state. That means if you want khổng lồ tweak more, you are không lấy phí lớn revise it.

413 error request entity too large happens because the website server is phối to restrict large file sizes. Nginx has client_max_body_size to allow the maximum kích cỡ of the client request body. If the request exceeds the value, an error message emerges. That means we need khổng lồ reconfigure Nginx lớn allow the form size we want for uploading files.

Reconfiguring nginx.conf will require a text editor. We recommkết thúc Vi text editor as it will handle the job perfectly.

Access your VPS via ssh and type the following comm& on your terminal to lớn start editing with Vi:

vi /etc/nginx/nginx.confAfter that, you can add the following lines in nginx.conf as shown in the example below. It sets the maximum body kích cỡ of a client request that the VPS allows. So, make sure you put the right number as your maximum kích cỡ.

Xem thêm: Hướng Dẫn Tạo Landing Page Bằng Wordpress Bằng Plugin, Ztheme Là Gì

# mix client body toàn thân kích thước khổng lồ 8M #client_max_body_kích thước 8M;Save sầu & cthất bại the file. Then, you can reload the Nginx website hệ thống with this following command:

# nginx -s reload

Conclusion

If you want lớn upload a file larger than allowed by your VPS, you will face the 413 Request Entity Too Large error in WordPress. In this tutorial we overviewed 3 different methods lớn fix 413 error.


Chuyên mục: Kiến thức Hosting