I am developing a site that needs a file upload. I am using Laravel homestead on windows OS. so when I try to upload i get the error 413 Request Entity Too Large. The server is Nginx/1.15.8 . How do I solve this?..most of the solution I have seen does not explain how to get the directory for the nginx configuration file for homestead using windows.
Asked
Active
Viewed 1.6k times
19
-
Possible duplicate of [413 Request Entity Too Large - File Upload Issue](https://stackoverflow.com/questions/24306335/413-request-entity-too-large-file-upload-issue) – Matt Komarnicki Nov 12 '19 at 03:22
2 Answers
54
sudo nano /etc/nginx/nginx.conf
Then add a line in the http section
http {
client_max_body_size 100M;
}
don't use MB only M.
sudo systemctl restart nginx
then for php location
sudo gedit /etc/php5/fpm/php.ini
for 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 use
check those increasing by your desire .
memory_limit = 128M
post_max_size = 20M
upload_max_filesize = 10M
restart php-fpm
sudo service php-fpm restart

Syed Abidur Rahman
- 869
- 8
- 13

albus_severus
- 3,626
- 1
- 13
- 25
-
8it really solved my problem. I only had to make changes to the nginx server, because the php.ini (7.3) default setting for my homestead version is ok. – Chukwuebuka Nov 14 '19 at 01:46
7
I solved the same problem like this:
Connect to vagrant trough ssh
vagrant ssh
Edit the conf file of nginx:
sudo nano /etc/nginx/nginx.conf
Add a line to the HTTP section
http {
...
client_max_body_size 100M;
}
Restart the Ngix server.
systemctl restart nginx
Locate the PHP configuration file (php.ini)
php --ini
Then edit the file (in my case)
sudo nano /etc/php/7.4/cli/php.ini
Set these two parameters:
post_max_size = 50M
upload_max_filesize = 50M
After modifying php.ini file, you need to restart Vagrant:
vagrant reload

Davide Casiraghi
- 15,591
- 9
- 34
- 56