Php, nginx


When I upload a 3MB file, I receive "413 Request Entity Too Large" with nginx/0.6.32

I am trying khổng lồ find nginx so I can increase "client_max_body_size" but I am unable khổng lồ find nginx installed on my server. I even tried running:

vi /etc/nginx/nginx.confor

vi /usr/local/nginx/conf/nginx.confto check if the config tệp tin exists, but I couldnt find it on my server.

Is there anyway khổng lồ resolve this issue? Or do I have lớn installed nginx on my server.

Bạn đang xem: Php, nginx


I have made all necessary changes in my php.ini files,

post_max_size 128Mupload_max_filesize 100Mmemory_limit 256MThanks,Raju

php nginx apache2
tóm tắt
Improve this question
edited Jun 19, năm trước at 12:42
Raju Vishwas
asked Jun 19, 2014 at 12:12

Raju VishwasRaju Vishwas
1,54133 gold badges1111 silver badges88 bronze badges
showroom a phản hồi |

11 Answers 11

Sorted by: Reset to default
Highest score (default) Date modified (newest first) Date created (oldest first)

Edit the conf file of nginx:

nano /etc/nginx/nginx.confAdd a line in the http section:

http client_max_body_size 100M;Doen"t use MB it will not work, only the M!

Also do not forget khổng lồ restart nginx

systemctl restart nginx
cốt truyện
Improve this answer
edited Jun 6, 2018 at 7:35


111 silver badge
answered Jun 20, năm 2016 at 7:26

1,97111 gold badge77 silver badges33 bronze badges
add a comment |
-in php.ini (inside /etc/php.ini)

max_input_time = 24000 max_execution_time = 24000 upload_max_filesize = 12000M post_max_size = 24000M memory_limit = 12000M-in nginx.conf(inside /opt/nginx/conf)

client_max_body_size 24000MIts working for my case

Improve this answer
answered Nov 12, 2014 at 5:28

90399 silver badges1111 bronze badges
địa chỉ a phản hồi |
First edit the Nginx configuration file (nginx.conf)

Location: sudo nano /etc/nginx/nginx.conf

Add following codes:

http client_max_body_size 100M;Then địa chỉ the following lines in PHP configuration file(php.ini)

Location: sudo gedit /etc/php5/fpm/php.ini

Add following codes:

memory_limit = 128M post_max_size = 20M upload_max_filesize = 10M
giới thiệu
Improve this answer
answered May 25, 2017 at 6:43


89799 silver badges1010 bronze badges
địa chỉ a bình luận |
sudo nano /etc/nginx/nginx.confThen địa chỉ cửa hàng a line in the http section

http client_max_body_size 100M;don"t use MB only M.

systemctl restart nginxthen for php location

sudo gedit /etc/php5/fpm/php.inifor nowdays maximum use php 7.0 or higher

sudo nano /etc/php/7.2/fpm/php.ini //7.3,7.2 or 7.1 which php you usecheck those increasing by your desire .

memory_limit = 128M post_max_size = 20M upload_max_filesize = 10Mrestart php-fpm

service php-fpm restart
mô tả
Improve this answer
answered Jun 9, 2020 at 9:00
3,28211 gold badge1111 silver badges2222 bronze badges
showroom a bình luận |
I địa chỉ cửa hàng the changes directly to lớn my virtualhost instead the global config of nginx, lượt thích this:

hệ thống client_max_body_size 100M; ... And then I change the params in php.ini, lượt thích the comments above:

max_input_time = 24000 max_execution_time = 24000 upload_max_filesize = 12000M post_max_size = 24000M memory_limit = 12000Mand what you can not forget is to restart nginx & php-fpm, in centos 7 is like this:

systemctl restart nginx systemctl restart php-fpm
mô tả
Improve this answer
answered Mar 20, 2019 at 15:59
87488 silver badges1111 bronze badges
add a phản hồi |
Please enter domain nginx tệp tin :

nano /etc/nginx/sites-available/domain.setAdd to file this code

client_max_body_size 24000M;If you get error use this command

nginx -t
Improve this answer
answered Apr 2, năm ngoái at 6:14
70077 silver badges99 bronze badges
địa chỉ cửa hàng a bình luận |
I got the same error và fixed it with the below steps.

At first, edit the nginx.conf file.

vi /etc/nginx/nginx.conf

At the HTTP section, added the below line.

http client_max_body_size 100M;Finally restarted Nginx with the below command.systemctl restart nginx

tóm tắt
Improve this answer
answered Jun 18, 2021 at 12:28
Hiren ParghiHiren Parghi
1,74711 gold badge1818 silver badges2929 bronze badges
showroom a comment |
Assuming that you made the necessary changes in your php.ini files:

You can resolve the issue by adding the following line in your nginx.conf tệp tin found in the following path:

/etc/nginx/nginx.confthen edit the file using vim text editor as follows:

vi /etc/nginx/nginx.confand địa chỉ 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.

Xem thêm: Thanh Toán Bằng Paypal Như Thế Nào, Cách Sử Dụng Paypal

Worked for me, hope this helps.

giới thiệu
Improve this answer
edited Apr 8, năm nhâm thìn at 4:41
Brad Koch
17.6k1818 gold badges106106 silver badges132132 bronze badges
answered Feb 4, năm 2016 at 14:58
Samson 'Melah' NyabangaSamson 'Melah' Nyabanga
7111 silver badge66 bronze badges
địa chỉ cửa hàng a phản hồi |
I got the upload working with above changes. But when I made the changes I started getting 404 response in tệp tin upload which lead me to vày further debugging & figured out its a permission issue by checking nginx error.log


Check the current user and group ownership on /var/lib/nginx.

$ ls -ld /var/lib/nginxdrwx------. 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 lớn the user defined in nginx.conf in this case vagrant.

$ sudo chown -Rf vagrant:vagrant /var/lib/nginxVerify that it actually changed.

$ ls -ld /var/lib/nginxdrwx------. 3 vagrant vagrant 17 Oct 5 19:31 /var/lib/nginxReload nginx và php-fpm for safer sade.

$ sudo service nginx reload$ sudo service php-fpm reloadThe permission denied error should now go away. Kiểm tra the error.log (based on nginx.conf error_log location).

Chuyên mục: Domain Hosting