500 (Internal Server Error) with Laravel & Docker
I found a solution. I set the permission on my Laravel app using:
sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache
Related videos on Youtube
Janaka Pushpakumara
I am a highly self-motivated, organized person capable of understanding and solving complex problems in both team-based and self-managed software projects. I am passionate about my work and will take every challenge to improve skills and expertise in the latest technologies.
Updated on September 14, 2022Comments
-
Janaka Pushpakumara over 1 year
I create Laravel PHP application in Docker. First I setup Laravel app using
laravel new laravelDockerApp
it creates successfully.I verify it's setup by built-in server
php artisan serve
Then setup Local environment with Docker
docker-compose.yml
version: '2' services: web: build: context: ./ dockerfile: web.docker volumes: - ./:/var/www ports: - "8080:80" links: - app app: build: context: ./ dockerfile: app.docker volumes: - ./:/var/www
app.docker
FROM php:7-fpm RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \ && docker-php-ext-install mcrypt pdo_mysql WORKDIR /var/www
web.docker
FROM nginx:1.10 ADD ./vhost.conf /etc/nginx/conf.d/default.conf WORKDIR /var/www
vhost.conf
server { listen 80; index index.php index.html; root /var/www/public; location / { try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } }
I run
docker-compose up -d
command. app & web containers up successfully.When I check app in Browser usinglocalhost:8080
I got
500(Internal Server Error)
Please, can you help to solve this? Thanks.
-
Óscar Gómez Alcañiz about 3 yearsWhile this actually works, please see my comment for a different approach: stackoverflow.com/a/66189065/1038490 in case setting 777 on all these files doesn't sound very appealing.