413 요청 엔티티가 너무 큼-파일 업로드 문제
내 서버에 30MB 파일을 업로드하려고하는데 작동하지 않습니다.
내가 30메가바이트 파일을 업로드 할 때 페이지가로드는 " 페이지를 찾을 수 없습니다 "
3MB 파일을 업로드 할 때 nginx / 0.6.32에서 " 413 Request Entity Too Large "를 수신합니다.
nginx를 찾으려고해서 " client_max_body_size "를 늘릴 수 있지만 내 서버에 설치된 nginx를 찾을 수 없습니다. 나는 심지어 달리기를 시도했다.
vi /etc/nginx/nginx.conf
또는
vi /usr/local/nginx/conf/nginx.conf
구성 파일이 있는지 확인하기 위해 서버에서 찾을 수 없습니다.
이 문제를 해결할 방법이 있습니까? 또는 내 서버에 nginx를 설치해야합니까?
편집하다:
내 php.ini 파일에서 필요한 모든 사항을 변경했습니다.
post_max_size 128M
upload_max_filesize 100M
memory_limit 256M
고마워, 라주
출처 : http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/
nginx의 conf 파일을 편집합니다.
nano /etc/nginx/nginx.conf
http 섹션에 다음 행을 추가하십시오.
http {
client_max_body_size 100M;
}
MB를 사용하지 마십시오. M 만 작동하지 않습니다!
또한 nginx를 다시 시작하는 것을 잊지 마십시오
systemctl restart nginx
-in php.ini (내부 /etc/php.ini)
max_input_time = 24000
max_execution_time = 24000
upload_max_filesize = 12000M
post_max_size = 24000M
memory_limit = 12000M
-nginx.conf (/ opt / nginx / conf 내부)
client_max_body_size 24000M
내 사건을 위해 일해
먼저 Nginx 구성 파일 ( nginx.conf
)을 편집합니다.
위치: sudo nano /etc/nginx/nginx.conf
다음 코드를 추가하십시오.
http {
client_max_body_size 100M;
}
그런 다음 PHP 구성 파일 ( php.ini
) 에 다음 줄을 추가합니다.
위치: sudo gedit /etc/php5/fpm/php.ini
다음 코드를 추가하십시오.
memory_limit = 128M
post_max_size = 20M
upload_max_filesize = 10M
도메인 nginx 파일을 입력하십시오 :
nano /etc/nginx/sites-available/domain.set
이 코드 파일에 추가
client_max_body_size 24000M;
오류가 발생하면이 명령을 사용하십시오.
nginx -t
php.ini 파일에서 필요한 사항을 변경했다고 가정합니다.
다음 경로에있는 nginx.conf 파일에 다음 줄을 추가하여 문제를 해결할 수 있습니다.
/etc/nginx/nginx.conf
그런 다음 다음과 같이 vim 텍스트 편집기를 사용하여 파일을 편집하십시오.
vi /etc/nginx/nginx.conf
and add client_max_body_size with a large enough value, for example:
client_max_body_size 20MB;
After that make sure you save using :xi
or :wq
And then restart your nginx.
That's it.
Worked for me, hope this helps.
I got the upload working with above changes. But when I made the changes I started getting 404 response in file upload which lead me to do further debugging and figured out its a permission issue by checking nginx error.log
Solution:
Check the current user and group ownership on /var/lib/nginx.
$ ls -ld /var/lib/nginx
drwx------. 3 nginx nginx 17 Oct 5 19:31 /var/lib/nginx
This tells that a possibly non-existent user and group named nginx owns this folder. This is preventing file uploading.
In my case, the username mentioned in "/etc/nginx/nginx.conf" was
user vagrant;
Change the folder ownership to the user defined in nginx.conf in this case vagrant.
$ sudo chown -Rf vagrant:vagrant /var/lib/nginx
Verify that it actually changed.
$ ls -ld /var/lib/nginx
drwx------. 3 vagrant vagrant 17 Oct 5 19:31 /var/lib/nginx
Reload nginx and php-fpm for safer sade.
$ sudo service nginx reload
$ sudo service php-fpm reload
The permission denied error should now go away. Check the error.log (based on nginx.conf error_log location).
$ sudo nano /path/to/nginx/error.log
I add the changes directly to my virtualhost instead the global config of nginx, like this:
server {
client_max_body_size 100M;
...
}
And then I change the params in php.ini, like the comments above:
max_input_time = 24000
max_execution_time = 24000
upload_max_filesize = 12000M
post_max_size = 24000M
memory_limit = 12000M
and what you can not forget is to restart nginx and php-fpm, in centos 7 is like this:
systemctl restart nginx
systemctl restart php-fpm
Open file/etc/nginx/nginx.conf
Add or change client_max_body_size 0;
Use:
php -i
command or add:
phpinfo();
to get the location of configuration file.
Update these variables according to your need and server
max_input_time = 24000
max_execution_time = 24000
upload_max_filesize = 12000M
post_max_size = 24000M
memory_limit = 12000M
On Linux you will need to restart nginx / apache and phpfpm service so the new ini settings are loaded. On xampp, ammps you can restart these from control panel that comes with such applications.
참고URL : https://stackoverflow.com/questions/24306335/413-request-entity-too-large-file-upload-issue
'developer tip' 카테고리의 다른 글
정의되지 않은 표현식 값에 대해 AngularJS에서 자리 표시자를 표시하는 방법은 무엇입니까? (0) | 2020.11.30 |
---|---|
HelloCordova에서 Ionic 앱의 이름을 바꾸는 방법 (0) | 2020.11.30 |
실행중인 스크립트의 소스 경로를 어떻게 찾을 수 있습니까? (0) | 2020.11.30 |
시간 부분을 무시하고 T-SQL에서 날짜 비교 (0) | 2020.11.30 |
하나의 작업에 대한 컨트롤러 AuthorizeAttribute 재정의 (0) | 2020.11.30 |