dockerコンテナを起動後、ページアクセスするも「403 Forbidden」と表示されます。権限などの問題かと思いますが、何が原因なのかをご教示いただければと思います。
docker-compose.yml
version: '3' services: web: image: nginx:1.15.6 ports: - "8000:80" depends_on: - app volumes: - ./docker/web/default.conf:/etc/nginx/conf.d/default.conf - .:/var/www/html app: build: ./docker/php volumes: - .:/var/www/html depends_on: - mysql mysql: image: mysql:5.7 environment: MYSQL_DATABASE: **** MYSQL_USER: root MYSQL_PASSWORD: **** MYSQL_ROOT_PASSWORD: **** ports: - "3306:3306" volumes: - mysql-data:/var/lib/mysql volumes: mysql-data:
Docker.file
FROM php:7.2-fpm # install composer RUN cd /usr/bin && curl -s http://getcomposer.org/installer| php && ls -s /usr/bin/composer.phar RUN apt-get update \ && apt-get install -y \ git \ zip \ unzip \ vim RUN apt-get update \ && apt-get install -y libpq-dev \ && docker-php-ext-install pdo_mysql pdo_pgsql mysqli WORKDIR /var/www/html
default.conf
server { listen 80; root /var/www/html/; index index.php index.html index.htm; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { try_files $uri $uri/ /index.php$is_args$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; } }
コンテナ起動確認
d14940a5fd4e mysql:5.7 "docker-entrypoint.s…" 4 days ago Up 37 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp workspace_mysql_1 7a5f38dc7a5f nginx:1.15.6 "nginx -g 'daemon of…" 4 days ago Up 37 minutes 0.0.0.0:8000->80/tcp workspace_web_1 a5aea63e4d25 workspace_app "docker-php-entrypoi…" 4 days ago Up 37 minutes 9000/tcp workspace_app_1
回答1件
あなたの回答
tips
プレビュー