Phần mở rộng docker-php xml

Với nền tảng tương đối lớn như Magento, việc cài đặt để nó chạy thôi cũng khá mất công, vì kiến ​​trúc của nó yêu cầu khá nhiều thành phần, cấu hình liên quan. Vì vậy, với một nhóm phát triển thì việc sử dụng docker trong trường hợp này có thể nói khá là "sự lựa chọn hoàn hảo", kiểu như "cài đặt bằng một cú nhấp chuột" vậy. D Chỉ mất thời gian config docker lúc ban đầu, sau đó mọi người trong team hay kể cả thành viên mới sau này có thể dễ dàng xây dựng môi trường phát triển cũng như đảm bảo môi trường dev giữa các thành viên không quá khác biệt,

Trong bài viết này, chúng ta sẽ tìm hiểu về công việc config docker lúc ban đầu nó như thế nào. D

Nhận mã nguồn Magento 2

Có 2 cách để lấy mã nguồn của Magento 2, ở đây là phiên bản Magento Commerce đó là

  • Tải xuống tệp zip từ trang www. magento. com, lưu ý là bạn phải có tài khoản để tải bản Commerce (bản dành cho doanh nghiệp, miễn phí), sau đó giải nén vào thư mục

    unzip -d magento-ee Magento-EE-2.3.4-2020-01-22-11-32-19.zip
    
  • Sử dụng

    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    2 để tạo dự án

     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    

    Khi chạy lệnh, nó sẽ yêu cầu bạn nhập tên người dùng và mật khẩu để có thể tải xuống bản Commerce, tham khảo hướng dẫn lấy khóa xác thực

    Sau đó, bạn có thể lưu các khóa này vào tệp

    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    3 để mỗi khi sử dụng
    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    4 hoặc
    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    5 bạn không cần phải nhập lại nữa, đã có tệp mẫu
    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    6

    cd magento-ee
    cp auth.json.sample auth.json
    

    Tất nhiên bạn cũng nên chọn tệp

    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    3 vào tệp
    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    8 để tránh chuyển tệp này lên kho lưu trữ từ xa

Sau khi lấy được mã nguồn, việc đầu tiên nên làm đó là thêm luôn vào git để quản lý và theo dõi các thay đổi

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
0

Vì trong source code lấy về đã có sẵn file

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
8 nên bạn không cần phải lo git add both these files

Yêu cầu hệ thống

Về hệ điều hành, tất nhiên đó là Linux (không giới hạn các bản phân phối như RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian,. ) và theo tài liệu của Magento là họ không chắc việc chạy Magento trên các hệ điều hành Windows hay MacOS. Hệ điều hành nên được cài đặt sẵn các công cụ

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
2

Về bộ nhớ RAM, Magento khuyên dùng đó là > 2GB, sở dĩ nó cần nhiều bộ nhớ như vậy chủ yếu là do quá trình nâng cấp Magento hay các extension, còn riêng về giới hạn bộ nhớ PHP chỉ cần < 1GB là đủ để chạy website rồi.

Máy chủ web có thể là Apache hoặc Nginx. Magento khuyên bạn nên sử dụng Nginx và PHP-FPM để đạt được hiệu quả tốt hơn, vì thế ở đây chúng ta cũng sẽ sử dụng Nginx

Cơ sở dữ liệu sẽ là MySQL 5. 7

PHP phiên bản 7. 2 hoặc 7. 3 (khuyến nghị) và các tiện ích mở rộng

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
3

PHP OPcache nên được bật và các cài đặt PHP

  • Múi giờ. https. //www. php. net/manual/en/múi giờ. php
  • Giới hạn bộ nhớ PHP. khi chạy ở môi trường production có thể để giới hạn là 1GB, còn ở môi trường dev cần nâng cấp magento hay extension hoặc chạy unit test thì có thể để ở mức 2 - 3GB
  • Thiết lập
    version: '3'
    
    services:
      php:
        #...
      nginx:
        #...
      mysql:
        #...
      redis:
        #...
      mail-server:
        #...
      varnish:
        #...
    
    40 do Magento 2 sử dụng nhận xét mã PHP để tạo mã
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
5

Magento 2 sử dụng nhiều đến cookie, do đó ở môi trường dev cũng nên sử dụng tên miền để hỗ trợ cookie tốt hơn so với localhost hay 127. 0. 0. 1. Ngoài ra HTTPS còn là yêu cầu thiết yếu khi đi vào hoạt động, do đó chúng ta cũng thiết lập HTTPS cho môi trường dev luôn

Mail server cũng cần thiết khi dev, ở đây chúng ta sẽ sử dụng Mailhog để tạo SMTP server dev

Redis cũng khuyến nghị sử dụng bộ nhớ đệm trang và phiên, để đảm bảo khả năng mở rộng quy mô hoặc sử dụng cân bằng tải, khuyến nghị Redis 5. 0

Tương tự Varnish cũng không thể thiếu khi đi vào hoạt động, do đó chúng ta cũng thiết lập để chạy Varnish 6. 2

Xây dựng môi trường docker

Về cơ bản chúng ta xây dựng các docker container như sau

Phần mở rộng docker-php xml

Sử dụng

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
41, mỗi vùng chứa được mô tả bằng một
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
42

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...

PHP FPM

First is container for PHP-FPM. Do yêu cầu cần nhiều tiện ích mở rộng nên image sẽ không có sẵn nên chúng ta sẽ tạo image mới bằng Dockerfile. Hình ảnh nổi bật thường được sử dụng cho PHP-FPM đó là

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
43. Trong quá trình tạo Dockerfile, chúng ta có thể sử dụng hình ảnh để tạo vùng chứa và chạy thử lệnh trực tiếp cài đặt trực tiếp

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
4

Ngoài việc cài đặt các tiện ích mở rộng PHP, chúng tôi sẽ cài đặt thêm một số công cụ vì đây là vùng chứa thường được sử dụng để tương tác với Magento thông qua lệnh

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
44 như
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
45,
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
46,
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
47 để chạy Magento cron hoặc
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
2 (cần thêm
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
49)

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
7

Chú thích các gói

  •  composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    70,
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    71,
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    72 must be used to install extension
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    73
  •  composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    74 to use for extension
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    75
  •  composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    76 used for extension
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    77
  •  composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    78 used for extension
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    79
  • And
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    00 used for extension
     composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
    
    01

Sau khi cài đặt xong các gói trong hệ thống, chúng ta xóa bộ nhớ cache của

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
02 để giảm kích thước của hình ảnh

Một người dùng mới là

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
03 được tạo trong hệ thống, người dùng này là người dùng để họ thực hiện lệnh
version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
44 Giả sử quyền của tệp đảm bảo không bị xung đột giữa người dùng máy chủ web
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
05 và người dùng cli
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
03, bằng cách thêm người dùng
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
03 vào nhóm
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
08, sau đó . Chi tiết, bạn có thể tham khảo thêm https. //devdocs. magento. com/hướng dẫn/v2. 3/install-gde/prereq/file-system-perms. html#perms-riêng tư

Bạn có thể tìm hiểu thêm về bit

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
10 hay
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
11 trong chmod, cụ thể ở lệnh này

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
12

Mục đích của Magento là muốn các tập tin hay thư mục được tạo mới trong các thư mục

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
13,
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
14,
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
15,
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
16
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
17 và
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
18 sẽ luôn thuộc nhóm của thư mục cha, cho dù người dùng tạo tập tin hay thư mục đó có thuộc nhóm gì đi chăng nữa. Ở đây là nhóm của người dùng chạy máy chủ web
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
08 ở bước chạy lệnh
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
20 hoặc
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
21

Sau đó là tạo tệp

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
22 mặc định từ tệp ví dụ
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
23 và thêm một số cài đặt khác bằng tệp
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
24

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
0

Mặc định, container chạy ở cổng 9000, do các container khác đó, cụ thể là nginx có thể kết nối vào địa chỉ.

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
25

Ta has docker-compose service first

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
1

Nginx

Tiếp theo là bộ chứa cho máy chủ web Nginx, có nhiệm vụ giao tiếp với PHP-FPM và trả về phản hồi cho máy khách. Với dịch vụ này, để tận dụng khả năng sử dụng lại image có sẵn và giảm bớt công việc phải build image, nếu chúng ta không cần sử dụng Dockerfile tùy chỉnh, ở đây chỉ cần sử dụng image

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
26 và thực hiện mount file config

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
2

Tệp

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
27 chỉ rút gọn như thế này vì Magento đã cung cấp sẵn 1 tệp mẫu

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
3

Lưu ý đến đường dẫn

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
28. Và trong tệp
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
29 có một đoạn đặt tài liệu gốc

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
4

mysql

Tương tự, chúng ta cũng có thể sử dụng image

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
30 trực tiếp và tạo user, db qua init SQL file mà không cần custom image

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
5

Tập tin khởi tạo SQL. tạo người dùng cơ sở dữ liệu và sử dụng cơ sở dữ liệu cho Magento

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
6

Bạn có thể xuất bản cổng

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
31 để kết nối với MySQL tại máy chủ (bằng MySQL Workbench, Phpmyadmin,. ) hoặc sử dụng container adminer

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
7

File

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
24 mình setting tăng giới hạn upload file để import cơ sở dữ liệu, cũng không cần thiết

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
8

Giao diện web quản lý tại địa chỉ chị http. //máy chủ cục bộ. 8088

Nếu là lần cài đặt Magento đầu tiên, chúng ta cần chạy lệnh để cài đặt Magento, còn không thì chỉ cần nhập lại cơ sở dữ liệu cũ, giả sử lược đồ cơ sở dữ liệu không bị thay đổi (do Magento có nhiều chức năng cập nhật qua giao diện web

Phần mở rộng docker-php xml

Lệnh cài đặt cho lần đầu tiên

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
9

URL. http. //máy chủ cục bộ. 8011 chính là url của trang web, do hiện tại chưa có Varnish hay custom domain nên nó là Nginx, vậy nên cần phải publish port 8011 cho Nginx sau đó để có thể truy cập được trang web từ máy chủ

Địa chỉ trang quản trị. http. //máy chủ cục bộ. 8011/admin_mn

Sau khi chạy lệnh trên Magento sẽ tạo ra 2 tệp cấu hình

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
33 và
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
34. Theo như docs, file
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
35 không được thêm vào git, còn
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
36 thì nên thêm. Do not add on git, we based on file
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
35 to create file example chung cho docker môi trường.
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
38

làm lại

Docker config for redis cũng khá đơn giản

cd magento-ee
cp auth.json.sample auth.json
0

Redis được sử dụng để lưu phiên và bộ đệm mặc định (cũng có thể lưu cả bộ đệm toàn trang - FPC). Sau khi chạy redis dịch vụ, cần cập nhật lại tệp

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
35 để cấu hình sử dụng redis

cd magento-ee
cp auth.json.sample auth.json
1

Lưu ý, mỗi loại cache, session thì sẽ có cơ sở dữ liệu khác nhau, cơ sở dữ liệu 0 cho cache mặc định, cơ sở dữ liệu 1 cho FPC và cơ sở dữ liệu 2 cho redis. Cấu hình

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
40 để tham khảo vì chúng ta sẽ sử dụng Varnish nên cấu hình này sẽ bị loại bỏ

Truy cập trang quản trị xuất tệp cấu hình của Varnish để tiếp tục thiết lập bộ đệm Varnish

Hoặc có thể sử dụng lệnh để xuất

cd magento-ee
cp auth.json.sample auth.json
2

Sơn dầu

Để lấy file config Varnish mặc định của Magento, chúng ta vào trang quản trị. http. //máy chủ cục bộ. 8011/admin_mn và đến trang cấu hình theo menu.

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
41 =>
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
42 =>
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
43 =>
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
44 =>
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
45

Phần mở rộng docker-php xml

Docker soạn dịch vụ

cd magento-ee
cp auth.json.sample auth.json
3

Vì đã cấu hình bằng Varnish nên máy chủ nginx giờ đây không cần xuất bản cổng 8011 nữa mà sẽ để Varnish cache làm nhiệm vụ này

Lưu ý trong tệp xuất

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
46 có đoạn

cd magento-ee
cp auth.json.sample auth.json
4

Chú ý url để kiểm tra sức khỏe là

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
47 chứ không phải
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
48 do ở phần setting nginx trước, document root đang là
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
49

Máy chủ thư

Mail server có nhiệm vụ bắt tất cả email được gửi trong môi trường dev, để đảm bảo không gửi nhầm email đến địa chỉ thật. Ở đây chúng ta sử dụng

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
50, nó cung cấp máy chủ SMTP để gửi thư và một giao diện web ui để đọc các email đã gửi

cd magento-ee
cp auth.json.sample auth.json
5

Cần phải cài đặt thêm tiện ích mở rộng để Magento có thể sử dụng máy chủ SMTP, phần này tùy thuộc vào khách hàng nên bạn có thể tự tìm mô-đun SMTP của Magento

Hộp thư ui ở địa chỉ. http. //máy chủ cục bộ. 8022

Như vậy là chúng ta đã thiết lập xong các container image. Total results we are add on the following file

cd magento-ee
cp auth.json.sample auth.json
6

Sau khi cài đặt xong phần thiết lập ban đầu, các thành viên khác trong nhóm chỉ cần kéo mã về và sao chép tệp cấu hình

cd magento-ee
cp auth.json.sample auth.json
7

Docker soạn và sau đó nhập cơ sở dữ liệu

Miền tùy chỉnh và HTTPS

Về custom domain cho dịch vụ trong Docker có nhiều cách, nhưng hôm nay mình giới thiệu cho các bạn một cách đơn giản nhất đó là sử dụng Nginx hoặc Apache ở máy chủ để tạo reverse proxy đến địa chỉ

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
51

Luat active like this

Phần mở rộng docker-php xml

Ơ nhưng dùng docker rồi vẫn phải cài thêm Apache hay Nginx ở máy thật sao??

Về HTTPS, chúng ta sử dụng công cụ

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
52 để tạo chứng chỉ SSL hợp lệ cho localhost

cd magento-ee
cp auth.json.sample auth.json
8

Lệnh trên tạo tập tin ra 2.

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
53 và
 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
54 đã sẵn sàng để sử dụng cho Apache hoặc Nginx

Command and config bên dưới dùng cho Ubuntu, nếu bạn dùng distro khác thì chú ý nhé

Với Apache, việc đầu tiên là kích hoạt mô-đun proxy http

cd magento-ee
cp auth.json.sample auth.json
9

Sau đó thêm virtualhost, có thể thiết lập chỉ HTTPS hoặc cả 2

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
00

khởi động lại apache

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
01

Với Nginx

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
02

Khởi động lại nginx

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
03

Tiếp theo là tên miền được thêm vào

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition magento-ee
55

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
04

Bước cuối cùng là cập nhật url cơ sở magento, từ http. //máy chủ cục bộ. 8011 sang https. // magento2. kiểm tra

version: '3'

services:
  php:
    #...
  nginx:
    #...
  mysql:
    #...
  redis:
    #...
  mail-server:
    #...
  varnish:
    #...
05

Because is done. Hẹn gặp lại các bạn trong các bài tiếp theo của sê-ri. Đ.

Phần mở rộng docker-php xml

Trên đây là công việc mình config docker lúc ban đầu, bạn nào muốn dùng luôn thì xem hướng dẫn ở Github nhé. https. //github. com/tuanpht/magento2-docker