Lỗi docker phpize không thành công

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 tệp sao chép 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ủ Đề