413 request entity too large что значит
Перейти к содержимому

413 request entity too large что значит

  • автор:

Support

Find answers, guides, and tutorials to supercharge your content delivery.

Fixing 413 Request Entity Too Large Errors

Fixing 413 Request Entity Too Large Errors

The 413 Request Entity Too Large error already gives a hint in its name about what the solution to the problem could be. It’s literally a size problem.

This article will go through step-by-step how you can fix the 413 Request Entity Too Large error. As with all error messages, there are more or less elaborate measures you can take to get to the problem’s solution. We’ll show you how to make the process of fixing the error as simple as possible.

What does 413 Request Entity Too Large mean?

A 413 Request Entity Too Large error occurs when a request made from a client is too large to be processed by the web server. If your web server sets a specific HTTP request size limit, clients may come across a 413 Request Entity Too Large response. An example request that may cause this error would be if a client was trying to upload a large file to the server (e.g., a large media file).

Meanwhile, the error is also known as the 413 Payload Too Large error. The name has been changed to be more clear and more specific. Nevertheless, you will see the old name much more often in practice.

But why does this error occur at all? The simplest explanation is that the server is set to explicitly deny too large uploads.

It depends on the type of web server you are using, which will determine which directive you need to configure. Whether you want to restrict users from uploading overly large files to your web server or want to increase the upload size limit, the following section will explain how.

Fixing 413 Request Entity Too Large errors

Fixing this error is about increasing the maximum file size for the server in question. Once that is done, the error should no longer occur.

Depending on which web server you use, implement the necessary changes described below to configure your web server’s maximum HTTP request size allowance. You can set the threshold file size for which a client is allowed to upload, and if that limit is passed, they will receive a 413 Request Entity Too Large status.

The troubleshooting methods require changes to your server files. For this reason, we recommend that you create a backup before performing the following steps.

Nginx

For Nginx users, the directive which determines what the allowable HTTP request size can be is client_max_body_size . This directive may already be defined in your nginx.conf file located at /etc/nginx/nginx.conf . However, you can add that directive in either an http, server, or location block and define a value if it isn’t.

The default value for this directive is 1M (1 megabyte). If you do not wish to have a request size limit, you can set the value to 0 .

Once you have set your desired value, save your changes and reload Nginx by running the following command: systemctl reload nginx .

Apache

For Apache web servers, there is a similar directive called LimitRequestBody. This directive provides the same functionality as client_max_body_size in that you are able to restrict the size of an HTTP request. The LimitRequestBody directive can be defined in your http.conf file or an .htaccess file. The default value for this directive in Apache is 0 , however, you may set this value to whatever you like (the value is represented in bytes).

For example, if you wanted to restrict requests larger than 100 MB, you would use the following.

Once you are done making your changes, save the configuration file and reload Apache using the following command: systemctl reload apache2 .

Additional configuration — PHP users

In addition to modifying the appropriate directive on your web server, several other changes are required for PHP users. First, you need to open up your php.ini file, which will most likely be located in a directory similar to /etc/php8/fpm/php.ini (depending on your PHP version). Next, you’ll need to find and modify the following directives:

    , which defines the maximum allowed size for uploaded files (default is 2 MB). , which defines the maximum size of POST data that PHP will accept. This setting also affects the file uploads (default is 8 MB).

Once the above directives are modified to reflect your desired allowable HTTP request size, simply save the configuration and reload PHP-FPM by running the following command: systemctl restart php-fpm .

How to Fix the «DNS Server Not Responding» Error

One of the most common errors that Windows and Mac users will see when trying to access a website is «DNS Server Not Responding.» This problem can occur for many reasons, but the good news is that you can take steps to fix it. Considering…

How to Fix the ERR_CONNECTION_REFUSED Error (Chrome)

If you frequently use the Internet, chances are you have encountered the ERR_CONNECTION_REFUSED error. It is one of the most common and persistent errors that Chrome users encounter. It can be caused by numerous issues and could even be a sign that…

Что означает ошибка 413 и как ее исправить

В редких случаях, но бывает, что во время загрузки больших файлов на веб-сайт возникает ошибка, которую возвращает веб-сервер Nginx — 413 Request Entity Too Large. Ошибка появляется, при попытке загрузить на сервер слишком большой файл чем это разрешено на сервере. Дальше рассмотрим описание ошибки 413 Request Entity Too Large а также методы её исправления на стороне веб-сервера Nginx.

Что означает ошибка 413

Ошибка 413 или Request Entity Too Large расшифровывается как «объект запроса слишком велик» или простыми словами объем передаваемых данных слишком большой. Ошибка возвращается в случае, если сервер не может обработать запрос по причине слишком большого размера тела запроса (или большого файла). Снимок экрана с ошибкой изображен ниже:

По умолчанию в Nginx установлен лимит на размер тела запроса который равен 1 МБ. Если запрос превышает установленное значение, вы увидите ошибку 413 Request Entity Too Large.

Как исправить

Для исправления ошибки 413 следует увеличить допустимый лимит. Увеличить размер тела запроса и соответственно, загружаемых файлов, можно путем использования client_max_body_size. Опциюя доступна для использования в директивах http, server или location в конфигурационном файле /etc/nginx/nginx.conf или в конфигурационном файле веб-сайта.

Откройте конфигурационный файл nginx.conf при помощи любого текстового редактора:

Вписываем строчку в секцию http:

100 — максимальный размер файла в мегабайтах который можно загрузить на веб-сайт, в данном случае — 100 мегабайт. Если в распоряжении имеется несколько веб-сайтов и необходимо ограничить загрузку на все сайты сразу, то строку client_max_body_size необходимо вписываем в раздел блока http. Если ограничение на загрузку необходимо выставить только для конкретного сайта, то строку client_max_body_size необходимо добавить в блок server конфигурационного файла сайта, который по умолчанию находиться в /etc/nginx/sites-available/имя_файла_с_конфигурацией:

Когда ограничение на загрузку необходимо выставить только для конкретного раздела на сайте, строку client_max_body_size необходимо вписать в директиву location конфигурационного файла сайта, который по умолчанию находиться в /etc/nginx/sites-available/имя_файла_с_конфигурацией:

Как только были внесены изменения в конфигурационные файлы, сохраните их, закройте текстовый редактор и проверьте синтаксис конфигурационных файлов на наличие ошибок при помощи команды:

Вы можете увидеть следующие строки:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Это означает что ошибок нет. В противном случае будет выведено описание ошибки, имя файла в котором найдена ошибка и номер строки. После внесения любых изменений в конфигурационные файлы Nginx их необходимо перезапустить при помощи команды:

В этой статье рассмотрена ошибка в Nginx, известная 413 Request Entity Too Large, возникающая при загрузке больших файлов на веб-сайт. Помимо описания самой ошибки также было описаны шаги по устранению ошибки путем редактирования конфигурационных файлов Nginx.

Ошибка 413 request entity too large Nginx

Иногда при загрузке больших файлов на какой-либо веб-сайт может возникнуть ошибка, которую возвращает веб-сервер Nginx — 413 Request Entity Too Large. Данная ошибка появляется, при попытке загрузить на сервер слишком большой файл чем это разрешено на сервере.

В данной небольшой статье будет рассмотрено описание ошибки 413 Request Entity Too Large а также методы её исправления на стороне веб-сервера Nginx.

Что означает ошибка 413 Request Entity Too Large

Ошибка 413 Request Entity Too Large дословно расшифровывается как объект запроса слишком велик или простыми словами объем передаваемых данных слишком большой. Данная ошибка возвращается в случае, если сервер не может обработать запрос по причине слишком большого размера тела запроса (или большого файла). Снимок экрана с ошибкой изображен ниже:

wP47iP96W9YvAAAAABJRU5ErkJggg==

По умолчанию в Nginx установлен лимит на размер тела запроса который равен 1 МБ. Если запрос превышает установленное значение, вы увидите ошибку 413 Request Entity Too Large.

Как исправить ошибку 413 Request Entity Too Large

Для того чтобы исправить данную ошибку необходимо увеличить допустимый лимит. Чтобы увеличить размер тела запроса и соответственно, загружаемых файлов, необходимо использовать параметр client_max_body_size. Данную опцию можно использовать в директивах http, server или location в конфигурационном файле /etc/nginx/nginx.conf или в конфигурационном файле веб-сайта.

Для этого необходимо открыть конфигурационный файл nginx.conf при помощи любого текстового редактора (например nano):

sudo nano /etc/nginx/nginx.conf

u5OMyOApCqZjMZNjHz4K0trEFvM5Pj+P8DzCrRn+soy7wAAAAASUVORK5CYII=

Далее впишите такую строчку в секцию http:

Здесь 100 — это максимальный размер файла в мегабайтах который можно загрузить на веб-сайт, в данном случае — 100 мегабайт. Если в распоряжении имеется несколько веб-сайтов (серверные блоки в терминологии Nginx, они же виртуальные хосты в понимании другого веб-сервера — Apache) и необходимо чтобы ограничение на загрузку действовало на все сайты сразу, то строку client_max_body_size необходимо вписать в раздел блока http. Как было показано выше.

Если ограничение на загрузку необходимо выставить только для конкретного сайта, то строку client_max_body_size необходимо добавить в блок server конфигурационного файла сайта, который по умолчанию находиться в /etc/nginx/sites-available/имя_файла_с_конфигурацией:

8H6OBHbwZnuAcAAAAASUVORK5CYII=

Если ограничение на загрузку необходимо выставить только для конкретного раздела на сайте, строку client_max_body_size необходимо вписать в директиву location конфигурационного файла сайта, который по умолчанию находиться в /etc/nginx/sites-available/имя_файла_с_конфигурацией:

KxgCLvBCQMwAAAAASUVORK5CYII=

После внесения изменений в конфигурационные файлы необходимо сохранить изменения, закрыть текстовый редактор и проверить синтаксис конфигурационных файлов на наличие ошибок при помощи команды:

j8OjMTx6bbbpAAAAABJRU5ErkJggg==

Если в выводе команды будут отображены следующие строки:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

Это означает что ошибок нет. В противном случае будет выведено описание ошибки, имя файла в котором найдена ошибка и номер строки. После внесения любых изменений в конфигурационные файлы Nginx их необходимо перезапустить при помощи команды:

sudo systemctl reload nginx

Выводы

В данной короткой статье была рассмотрена ошибка в Nginx под названием 413 Request Entity Too Large которая возникает при загрузке больших файлов на веб-сайт. Помимо описания самой ошибки также было описаны шаги по устранению ошибки путем редактирования конфигурационных файлов Nginx.

How to Fix 413 Request Entity too Large Error in WordPress

How to Fix 413 Request Entity too Large Error in WordPress

Ever tried uploading a file to WordPress only to see the 413 Request Entity Too Large error pop up? Annoying, right? Well don’t worry, we have a solution! In this article, we will teach you how to fix the 413 Request Entity Too Large error in WordPress.

What Does 413 Request Entity Too Large Error Mean?

The 413 Request Entity Too Large error means that the client’s request is too large to be processed by the server. The 413 error commonly occurs when uploading a file larger than the set server limit.

Hosting providers tend to have specific configurations on their server for uploading media to WordPress, and in most cases, these default settings provide sufficient resources for your posts and uploads.

However, in certain cases, you might need to upload a file that exceeds the size limit, and you will unfortunately face the 413 error.

How to Fix 413 Request Entity Too Large Error in WordPress

Luckily, there are a few ways to fix this issue. We will teach you three different methods of how to deal with the error 413 on WordPress.

Important! Two of the methods deal with important WordPress files, so we strongly suggest you back up your files before starting any configuration.

1. Modifying the functions.php file

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

File Manager in Hostinger hPanel.

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

In the Hostinger File Manager, you will see three folders under the public_html folder. Click on the wp-content folder that will give you a list of files on the right side. Double click on themes folder to find the functions.php file. Make sure you choose the file of the theme you are currently using.

Functions file in wp_content folder.

Double click the functions.php file and add the following code snippet. It will increase It will increase upload_max_size, post_max_size and max_execution_time values.

Editing functions.php file to set upload max size.

After you are finished, save the changes and try head back to WordPress admin area to test if you still get HTTP 413 error.

2. Modifying .htaccess file

The second method involves editing the .htaccess file, so be cautious not to make any unnecessary changes.

The .htaccess file is a configuration item which is read by the server. It can override server configuration settings for things like authorization, caching, or even optimization.

To reach the .htaccess file, you need to go to your public_html folder in your Hostinger control panel. On the right side, you will see the .htaccess file. Double click on it.

Locating Htaccess File in Hostinger Control Panel

You will get a popup window where you can add in the code. Read through the lines, when you find # END WordPress at the end of the file, paste in the following code under it:

Editing htaccess file to modify upload max size.

Make sure you save the modification and close the window. Go back to WordPress admin area and try upload a new.

3. Modifying Nginx Configuration

If you use a Hostinger VPS, you’ll get control over most of your server environment. We only reach basic server software (Apache or Nginx) in its default state. That means if you want to tweak more, you are free to revise it.

When the web server is set to restrict large file sizes, it can cause the 413 error request entity too large. Nginx has client_max_body_size to allow the maximum size of the client request body. If the request exceeds the value, an error message emerges. That means we need to reconfigure Nginx to allow the size we want for uploading files.

Reconfiguring nginx.conf will require a text editor. We recommend Vi text editor as it will handle the job perfectly.

Access your VPS via ssh and type the following command on your terminal to start editing with Vi:

After that, you can add the following lines in nginx.conf as shown in the example below. It sets the maximum body size of a client request that the server allows. So, make sure you put the right number as your maximum size.

Save and close the file. Then, you can reload the Nginx web server with this following command:

Now you can go ahead and check if the error 413 is gone.

Troubleshooting Other 4xx Errors

Conclusion

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

Richard is a WordPress software developer and an expert of content management systems. When he is not playing around with code, Richard enjoys good cinema and craft beer.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *