413 Request Entity Too Large in docker - laravel

i'm running a laravel project in docker, i'm uploading file on amazon s3 but when i upload file bigger than 5mb i get this error
1
i've already edited the nginx.conf file with
client_body_buffer_size 400M;
client_header_buffer_size 400M;
large_client_header_buffers 4 400M;
client_max_body_size 10G;
Someone can explain me?

Related

LaraDock multiproject laravel 8 - installation issue

I am completely new to LaraDock. After hours of trying to dockerize existing Laravel 8 projects, I discovered LaraDock. I have installed it successfuly and the container is running in Docker. When I go to localhost, however I get 404 not found. I need help to correctly set up the web server conf files.
So far I have created a new .conf file in apache2/sites as well as nginx/sites (as I do not know which webserver is running on Mac Monterey with LaraDock).
So in apache2/sites the new project1.conf has the following lines:
ServerName project1.test
DocumentRoot /Users/paul/Sites/project1
And in nginx/sites the project1.conf:
server_name project1.test;
root /Users/paul/Sites/project1;
index index.php index.html index.htm;
In the browser project1.test also returns error 404 not found.
In several .conf files the normal path to apache hosted file (/var/www/) does not exist on Monterey. Should I replace these instances by /Users/paul/Sites/ ?
What am I missing?
in laravel the document root should be /public on the end.
so it could be
/Users/paul/Sites/MeerkatSafaris/public
and / or
DocumentRoot /Users/paul/Sites/project1/public
but it is unclear which is the correct root in your question

NGINX does not accep files larger then 1MB

Stack: laravel7.0.8 + nginx 1.14.2
I cannot upload files bigger than 1MB, files less than 1MB are uploaded successfully.
nginx log does not show anything useful
laravel log is empty
In laravel at my controller endpoint I die and dump the validated data. If the file is less than 1 MB I get the dd() printout as expected. If the uploaded file is larger and 1MB no dd() message is displayed, the browser 'flashes' no page reload is initiated.
I tried the following, without success:
In the /etc/nginx/nginx.conf I added client_max_body_size 100M;
Then ran: nginx -s reload && nginx service restart
So my questions:
Is there anything else I can do to change the max body size ?
Are there a way to check any logs that can point in the right direction ?
Solved it by updating the php.ini file on the server.
In the php.ini the following parameters have to be changed:
post_max_size
upload_max_filesize
max_file_upload
If those three are not updated accordingly Laravel does not recognize the file and file related functions do not work.
When running nginx the php.ini file can be found by running the command:
php --ini
On nginx look for php-fpm.conf This is the file which has to be updated.
In order for the changes to be loaded the process has to be reloaded. On Debian the command is:
service php7.3-fpm reload
You will have to see what is the name of your php process. To see all process and find you php process you can use:
service --status-all

Laravel Increase Upload file Size Heroku

It looks like I cannot upload more than 2mb file with heroku.
I can upload 3mb file on my local but I can't upload the same file after pushing to heroku. (Using storage S3)
I updated the htaccess file and I have added
ini_set('upload_max_filesize', '64M');
to my controller but it doesn't work.
Is there a way we can change the php.ini setting on heroku?
you need to create .user.ini file in root directory
post_max_size = 25M
upload_max_filesize = 25M
then also updated .Procfile for apache
web: vendor/bin/heroku-php-apache2 -i user.ini rootDirectoryName/
for more information read this blog and official documention
Had a similar issue, I was googling and trying many solutions, but nothing helped, so I've decided to switch from Apache to NGINX and the problem was solved - https://stackoverflow.com/a/69509235/7092969
Overriding Heroku PHP ini files is kinda complicated and official Herkou documentation did not help me at all :/

Apache2 - Broken images load from remote server

I have an apache2 server running under Ubuntu 18.04
Strangely, apache cannot display images, event though my browser load it with a 200 response message.
If I trigger directly the image link, I can download it successfully, but the image cannot be open (wrong format), like it is broken.
This website used to work on another apache2 with approximately the same configuration.
I have tried to put an image file into the default folder (var/www) and display it with a simple src, it works !
My website that refuses to display images has this configuration in apache2.conf :
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
And the virtualhost looks like this :
<VirtualHost *:80>
ServerName nasticot.lan
DocumentRoot /var/www/nasticot.lan
ServerAlias www.nasticot.lan
</VirtualHost>
/var/www is an SMB share mounted from a remote container.
The server has full rights on every file into this share (777)
There is also an .htaccess file at the root of the website
# Rewrite URL like xxx/yyy/zzz in index.php?controleur=xxx&action=yyy&id=zzz
RewriteEngine on
RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controleur=$1&action=$2&id=$3 [NC,L]
[EDIT]
strangely, apache2 add content to my images on load.
I've verified one more time that my images are displayable directly in the folder read by my apache2 server, and it works.
If I download the image locally from the browser, the image has a few more line added to it.
[EDIT-01] :
My /var/www is a mounted share, located in my fileserver.
I found that this is the problem. If I copy the content of one of my website locally, images are displayed.
Event though I've full access to the mounted share :
root#coruscant:/var/www/nasticot.lan/Content/img/icon# ls -la /var/www
total 4
drwxrwxrwx 2 root www-data 0 Mar 20 15:54 .
drwxr-xr-x 14 root root 4096 Mar 20 19:31 ..
drwxrwxrwx 2 root www-data 0 Mar 24 11:08 nasticot.lan
And this is the share configuration in the fileserver :
[WWW]
path = /media/share/www
browseable = yes
writeable = yes
read only = no
force create mode = 0770
force directory mode = 2770
valid users = #sambashare
And finally, the fstab file on the webserver :
//192.168.0.53/WWW /var/www cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777,gid=www-data 0 0
Images file are loaded (200 OK) but broken ..
[EDIT-02]
Still looking for a solution, I'm pretty sure it's not a permission issu, the problem always appears even with 777 ...
I wonder if php could break the image on load, I tried to set
php.ini
error_reporting = E_ALL
error_log = /var/log/php_errors.log
But I got nothing written into this log file so .. don't really know where to search ..
Please any help would be very appreciated
Any idea ?
Thank you !
A workaround, but not an explanation as to the cause, is to add the EnableSendFile on directive in the Directory block.
I say it's a workaround because in my diagnosis of the same problem (Environment: Laravel Homestead 11 Vagrant guest, Windows 10 host using Hyper-V and smb mounts), it only happens if you use HTTP - HTTPS works just fine, which makes it the weirdest thing

My laravel project found http 500 error in live server and i got error_log like this

my laravel project work well in localhost but while i uoload to the webserver i found http 500 error
and error_log file is look like thisenter image description here
It seems that your classmap is incorrect. It typically happens when you run composer install in a folder and then rename it or one of its parents.
Run composer install from the root of your project.

Resources