413 request entity too large перевод

Nginx configuration

To fix this issue edit your nginx.conf. Open the Terminal or login to the remote server using ssh client. Type the following command to edit your nginx.conf using a text editor such as vi or joe or nano: Use nano text editor: Must be run as root: Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:

# set client body size to 2M #
client_max_body_size 2M;

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. If size is greater the given one, then the client gets the error “Request Entity Too Large” (413). Save and close the file. Reload the nginx webserver, enter: Use nginx itself to reload it: For RHEL/CentOS/Debian/Ubuntu Linux, try: If you are using systemd based system run:

Что такое ошибка HTTP 413?

Ошибка 413 — Request Entity Too Large говорит о том, что файл, который вы пытаетесь загрузить на сервер слишком большой для заданной конфигурации сервера. Обычно проблема возникает среди вебмастеров, которые создают свой первый сайт на базе CMS и при этом вообще не разбираются в коде. Как результат – не настроен сервер для обработки и загрузки изображений.

Обратите внимание, что в отличии от ошибки 409, здесь указана конкретная проблема. Здесь нет конфликта между настройками сервера

Нужно просто изменить переменные в настройках, если они доступны для вас в панели управления вашим хостинг аккаунтом.

Вебмастера могут столкнуться с ошибкой 413 Request Entity Too Large при использовании: NGINX, Apache, PHP. Чтобы устранить ошибку 413 нужно внести изменения в настройки, которые приведены ниже. Для этого вам понадобиться доступ к настройкам сервера или придется писать в поддержку хостинга, чтобы они внесли такие изменения (если вам не доступно).

По умолчанию, размер, который разрешен для загрузки – 1 мб. У меня на всех сайтах стоит 32 мб. Для пользователей размер установлен в рамках 4 мб., при этом в случае загрузки изображений на сайт, система автоматически их сжимает. Ниже представлены функции и их местонахождение.

Additional configuration — PHP users

In addition to modifying the appropriate directive on your web server, there are a couple of other changes 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 (depending on your PHP version). Next, you’ll need to find and modify the following directives:

  • upload_max_filesize which defines the maximum allowed size for uploaded files (default is 2 MB).
  • post_max_size which defines the maximum size of 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: .

Fixing 413 Request Entity Too Large errors

Depending on which web server you use, implement the necessary changes described below to configure your web server’s maximum HTTP request size allowance. By doing so, 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 status.

Nginx

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

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

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

Apache

For Apache web servers there is a similar directive called . This directive provides the same functionality as in that you are able to restrict the size of an HTTP request. The directive can be defined in your file or in an file. The default value for this directive in Apache is , 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: .

PHP configuration (optional)

Your php installation also put limits on upload file size. Edit php.ini and set the following directives

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M

;The maximum size of an uploaded file.
upload_max_filesize = 2M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 3M

If you are using PHP-FPM, restart it as follows: Save and close the file. Make sure you reload/restart back-end apache or nginx web server as per your setup. See “PHP Increase Upload File Size Limit” tutorial for more information.

Look out for permission errors too

Apart from setting Nginx and PHP, you need to look out file permission errors. Usually logged into your web server error.log file. Here is a sample error logged in to my lighttpd web server:

2017-07-18 07:09:18: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-9UMUXj Permission denied 
2017-07-18 07:23:45: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-a4PNg1 Permission denied 
2017-07-18 07:25:50: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-xIzdjU Permission denied 
2017-07-18 07:27:30: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-2s3I9J Permission denied 
2017-07-18 07:29:04: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-9KNsVa Permission denied 
2017-07-18 07:30:19: (connections.c.1095) denying upload as opening to temp-file for upload failed: /var/cache/lighttpd/uploads/lighttpd-upload-myoWrl Permission denied

To fix this you need to setup correct permission using the chmod command or chown command: See also Fix client intended to send too large body: xyz bytes in Nginx.

Как исправить ошибку 413?

Если у вас NGINX

В дефолтных (стандартных) настройках стоит ограничение в 1 мб. За размер отвечает функция «client_max_body_size». Данная настройка указывает допустимый размер запроса в строке «Content-Length». В случае, когда размер больше 1 мб., возвращается ошибка 413 Request Entity Too Large.

Для решения ищем файл «nginx.conf», а в нем пункт http, где нужно добавит или изменить указанный выше размер функции. Исправляем ошибку 413 примерно вот так:

В данном случае – 64м, это уже измененный допустимый размер, который ранее был 1м. Слишком много не стоит устанавливать, если в этом нет нужды. Почему? Уже не первый раз замечаю, что при больших объемах затрачивается много оперативной памяти и процессорных минут, что может привести к «диалогу» с администрацией хостинга. После установки параметров не забудьте перезагрузить конфиг.

Если у вас PHP

Не всегда все упирается в настройки сервера, но и в настройки PHP. Вне зависимости от версии PHP для изменения допустимого размера загружаемых фалов через PHP скрипты нужно найти файл php.ini. Этот файл обычно находится в папке «etc». Открываем встроенным редактором (если есть) или текстовым редактором, вроде Notepad++. Ищем строки, которые указаны ниже:

И устанавливаем в этих строках нужные вам размеры. Например, 8М – это и есть 8 мб. Для скриптов крайне противопоказано устанавливать разрешения на загрузку больших файлов. Также не стоит разрешать загружать произвольные файлы. В случае, если сайтом заинтересован злоумышленник, он легко сможет залить файлы на сайт, которые вам не понравятся.

Если у вас Apache

В отличии от примеров выше, в Apache размер указывается в байтах. Файл для редактирования находится по следующему адресу: /etc/httpd/conf/httpd.conf или /etc/apache/apache.conf. В файле нужно найти и изменить пункт «LimitRequestBody. Ниже пример.

В данной строчке лимит, который вы задаете – 1048576 или 8 МБ. Никаких букв после цифр ставить не нужно.

What does 413 Request Entity Too Large mean?

A error occurs when a request made from a client is too large to be processed by the web server. If your web server is setting a particular HTTP request size limit, clients may come across a 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).

It is dependent upon 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.

Пожалуйста, помогите c переводом:

1. Lol when @hartdenton develops his coachella polaroids
2. Usting @melton as my bitch for gueen
3. Trying to pack for LA
4. Fresh nails wha dis
5. Me once my motor cycle license is done this summer
6. So cute
7. The detail. . . even down to my snake rings. . . Amazing!

Английский-Русский

The rival gangs piled into one another with a vengeance — fists flew, knives flashed, clubs struck muscle and bone with sickening smacks

Английский-Русский

Mendeleev was foreshadowed in his great generalization by De Chancourtois’s helix of elements of 1863, J.A.R. New-lands’s *law of octaves* (1864-5)-which uncovered periodicity in the 8th elements of his chemical groupings — and W. Odling’s work, which suggested that recurrent chemical properties in elements arranged according to atomic weight could not be accidental.

Английский-Русский

Policy – Forestry Commission England continues to
take the lead on grey squirrel policy on behalf of Defra.

Английский-Русский

Что делать, если вы пользователь

Если вы видите ошибку 413, когда пытаетесь загрузить файл на чужом сайте, то вам нужно уменьшить размер передаваемых данных. Вот несколько ситуаций.

  • Если вы пытались загрузить одновременно несколько файлов (форма позволяет так делать), попробуйте загружать их по одному.
  • Если не загружается изображение, уменьшите его размер перед загрузкой на сервер. Можно сделать это с помощью онлайн-сервисов — например, Tiny PNG.
  • Если не загружается видео, попробуйте сохранить его в другом формате и уменьшить размер. Можно сделать это с помощью онлайн-сервисов — я использую Video Converter.
  • Если не загружается PDF-документ, уменьшите его размер. Можно сделать это с помощью онлайн-сервисов — я обычно использую PDF.io.

Универсальный вариант — архивация файла со сжатием. Ошибка сервера 413 появляется только в том случае, если вы пытаетесь одновременно загрузить слишком большой объем данных. Поэтому и выход во всех ситуациях один — уменьшить размер файлов.

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

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