Hello! Help please set up a working environment using the docker. Shoveled Russian and English SO, but did not find a suitable solution. I try to make a development environment using Docker, nginx, php, mysql. On a Ubuntu 18.04 host. I enter
docker-compose up -d --force-recreate --build Nginx, php, mysql start, work, but the site in the browser does not open. The request leaves, but there is absolutely nothing in return. The browser writes "Hmm. We can't find this site." And it's not clear where the problem is, with the network between the host and the docker or with the docker-compose.yml settings docker-compose.yml here is this content:
version: '3.7' services: nginx: image: nginx:1.12 restart: always ports: - "8080:80" - "4430:443" expose: - "80" networks: - bridge volumes: - ./hosts:/etc/nginx/conf.d - ./www:/var/www - ./logs:/var/log/nginx tty: true command: nginx -g "daemon off;" php: build: ./images/php volumes: - ./www:/var/www expose: - "9000" networks: - bridge mysql: image: mysql:5.7 volumes: - ./mysql:/var/lib/mysql expose: - "3306" networks: - bridge environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=devbd - MYSQL_USER=devuser - MYSQL_PASSWORD=password networks: bridge: driver: bridge The nginx config has the following form:
server { listen 80; server_name dev-php.local *.dev-php.local; root /var/www; index index.php index.html; error_log /var/log/nginx/dev-php-error.log; access_log /var/log/nginx/dev-php-access.log; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; try_files $uri =404; fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } Dockerfile for php image:
FROM php:7.0-fpm RUN apt-get update && apt-get install -y \ curl \ wget \ git \ libfreetype6-dev \ libjpeg62-turbo-dev \ libmcrypt-dev \ && docker-php-ext-install -j$(nproc) iconv mcrypt mbstring mysqli pdo_mysql zip \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd \ # RUN yes | pecl install xdebug \ && pecl install xdebug \ && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \ && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer ADD php.ini /usr/local/etc/php/conf.d/40-custom.ini WORKDIR /var/www CMD ["php-fpm"]