我在Docker中创建Laravel
PHP应用程序.首先我使用设置Laravel应用程序
laravel new laravelDockerApp
它成功创建.我通过内置服务器验证它的设置
php artisan serve
然后使用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;
}
}
我运行docker-compose up -d命令.应用程序web容器成功启动.当我在浏览器中使用时检查应用程序
localhost:8080
我有
500(Internal Server Error)
拜托,你能帮忙解决这个问题吗?谢谢.