Я настраиваю docker compose environment с приложением symfony 4 на основе Api-платформы. После настройки файла docker-compose, создания скелетного приложения на платформе Api, добавления конфигурации хоста nginx и запуска контейнеров у меня возникла проблема с подключением к этому приложению. Chrome говорит: «Этот сайт недоступен».
Ниже docker-compose.yml и app.conf для nginx. Я делаю что-то не так?
services:
php-cli:
image: bitnami/php-fpm:7.2
user: "${UID-www-data}:${GID-www-data}"
entrypoint: bash
depends_on:
- nginx
env_file:
- ./.env
volumes:
- ./:/usr/src/app:cached
php-fpm:
user: "${UID-www-data}:${GID-www-data}"
image: bitnami/php-fpm:7.2
env_file:
- ./.env
expose:
- '9000'
volumes:
- ./:/usr/src/app:ro
- ./var/log/php:/var/log/php
- ./.docker/php/config/php.ini:/usr/local/etc/php/php.ini:ro
working_dir: /usr/src/app
nginx:
image: nginx:1.14-alpine
depends_on:
- php-fpm
ports:
- "80:80"
- "443:443"
volumes:
- ./:/usr/src/app:ro
- ./.docker/nginx/ssl:/etc/nginx/ssl:ro
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./.docker/nginx/conf.d/app.conf:/etc/nginx/conf.d/default.conf
server {
listen 80;
server_name my.app;
return 301 https://my.app:443$request_uri;
}
server {
listen 443 ssl http2;
server_name my.app;
root /usr/src/app/public;
ssl_certificate /etc/nginx/ssl/my.app.crt;
ssl_certificate_key /etc/nginx/ssl/my.app.key;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
# Block hidden files
location ~ /\. {
deny all;
}
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
# remove trailing slashes
rewrite ^/(.*)/$ /$1 permanent;
location ~ ^/index\.php(/|$) {
# Comment the next line and uncomment the next to enable dynamic resolution (incompatible with Kubernetes)
fastcgi_pass php-fpm:9000;
#resolver 127.0.0.11;
#set $upstream_host php;
#fastcgi_pass $upstream_host:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
}