Docker-nginx-php-mysql github

Ở phần trước [ Cài đặt môi trường phát triển php với docker ] chúng ta đã làm việc đến phần docker-compose create php. Ở phần này mình xin nói rút gọn cách cài đặt xdebug.  

bài viết được viết bởi cường tráng hùng https. //ebudezain. com/

anh hùng đẹp trai

bài viết được viết bởi cường tráng hùng https. //ebudezain. com/

ahihi đồ ngốc nghếch thanh hùng nè

tôi thích như vậy

Đây là file docker Compose của mình với nội dung có cả mysql, nginx và php custom file.  

tôi thích như vậy

bài viết được viết bởi cường tráng hùng https. //ebudezain. com/

anh hùng đẹp trai

version: '3'
services:
    web:
        image: nginx:latest
        ports:
            - "80:80"
        volumes:
            - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
            - ./app:/app
    php:
        build:
            context: .
            dockerfile: PHP_CUSTOM.Dockerfile
        volumes:
            - ./app:/app
            - ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    mysql:
        image: mariadb:latest
        environment:
            MYSQL_ROOT_PASSWORD: 'secret'
            MYSQL_USER: 'admin'
            MYSQL_PASSWORD: 'secret'
            MYSQL_DATABASE: 'testing'
        volumes:
            - mysqldata:/var/lib/mysql
        ports:
            - 3306:3306
volumes:
    mysqldata: {}

anh hùng ebudezain

anh hùng ebudezain

anh hùng đẹp trai

bài viết được viết bởi cường tráng hùng https. //ebudezain. com/

anh hùng ebudezain

anh hùng thông minh lắm

read data support

anh hùng ebudezain

has a đoạn khá quan trọng.  

./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

anh hùng thông minh lắm

tôi thích như vậy

anh hùng thông minh lắm

tôi thích như vậy

bài viết được viết bởi cường tráng hùng https. //ebudezain. com/

ahihi đồ ngốc nghếch thanh hùng nè

read data support

ý nói là chúng ta sẽ liên kết tệp _______8 vào trong thư mục /usr/local/etc/php/conf.d/ Qua đó chúng ta sẽ có 1 tệp có tên là xdebug. ini as after

Tập tin docker-compose. yml bao gồm 2 dịch vụ. nginx và php. Nginx là máy chủ web sẽ phục vụ các tệp tĩnh, với những tệp có đuôi php sẽ được chuyển qua dịch vụ php lắng nghe ở cổng 9000

version: "3.8"
services:
  nginx:
    container_name: nginx
    build: ./docker/nginx
    command: nginx -g "daemon off;"
    links:
      - php
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www/html
  php:
    container_name: php
    build: ./docker/php
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html

docker-compose.yml

Dịch vụ nginx

FROM nginx:stable-alpine
ADD helloworld.nginx.conf /etc/nginx/conf.d/default.conf

docker/nginx/Dockerfile

version: "3.8"
services:
  nginx:
    container_name: nginx
    build: ./docker/nginx
    command: nginx -g "daemon off;"
    links:
      - php
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www/html
  php:
    container_name: php
    build: ./docker/php
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html

docker-compose.yml

0 sao chép tập tin docker/nginx/helloworld. nginx. conf to file
version: "3.8"
services:
  nginx:
    container_name: nginx
    build: ./docker/nginx
    command: nginx -g "daemon off;"
    links:
      - php
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www/html
  php:
    container_name: php
    build: ./docker/php
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html

docker-compose.yml

1 in docker container

File cấu hình nginx

server {
	listen 80;
	index index.php index.htm index.html;

	root /var/www/html;

	error_log  /var/log/nginx/error.log;
	access_log /var/log/nginx/access.log;

	location ~ \.php$ {
		try_files $uri =404;
		fastcgi_split_path_info ^[.+\.php][/.+]$;
		fastcgi_pass php: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/nginx/helloworld.nginx.conf

php service

FROM php:8.1-fpm-alpine

docker/php/Dockerfile

src

Trong thư mục src chúng ta tạo 2 tệp mã nguồn index. php and loop. php to try the service nginx - php active has true not?

Chủ Đề