I have been struggling to setup my dev enviroment based on Docker to run Laravel app. But it keeps showing me 403 Forbidden error
Below is my configuration. I tried to login to nginx container and tail -f /var/log/nginx/error.log
but it does not write anything. Please guide me what i am doing wrong here.
Thanks
docker-compose.yml
version: '2'
services:
nginx:
build: ./nginx
ports:
- "8000:80"
volumes:
- ./app:/usr/share/nginx/html
environment:
TERM: xterm
links:
- php
php:
build: ./php
volumes:
- ./app:/usr/share/nginx/html
environment:
TERM: xterm
links:
- mysql
mysql:
build: ./mysql
volumes:
- ./mysql/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: myapp
MYSQL_USER: root
MYSQL_USER: root
Dockerfile to build nginx container
FROM nginx
MAINTAINER Raheel <raheelwp@gmail.com>
RUN rm /usr/share/nginx/html/index.html
RUN mkdir /etc/nginx/sites-available/
RUN mkdir /etc/nginx/sites-enabled/
COPY myapp.conf /etc/nginx/sites-available/myapp.conf
RUN ln -s /etc/nginx/sites-available/myapp.conf /etc/nginx/sites-
enabled/myapp.conf
Dockerfile to build PHP container
FROM php:7.0-fpm MAINTAINER Raheel
RUN apt-get update && \
apt-get install -y curl && \
docker-php-ext-install mysqli pdo pdo_mysql
WORKDIR /usr/share/nginx/html
RUN curl -sS http://ift.tt/SI3ujS | php -- --install-dir=/usr/local/bin --filename=composer
myapp.conf
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Simple route to localhost:8000
Route::get('/', function () {
return 'Hello World';
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire