{"id":24755963,"url":"https://github.com/garymengcom/dnmp","last_synced_at":"2025-04-24T02:05:16.333Z","repository":{"id":37663860,"uuid":"89062439","full_name":"garymengcom/dnmp","owner":"garymengcom","description":"Docker LNMP (Nginx, PHP7/PHP5, MySQL, Redis)","archived":false,"fork":false,"pushed_at":"2025-04-02T03:31:10.000Z","size":26582,"stargazers_count":4012,"open_issues_count":40,"forks_count":1426,"subscribers_count":79,"default_branch":"master","last_synced_at":"2025-04-24T02:04:58.752Z","etag":null,"topics":["docker","lnmp","lnmp-dockerfile","mysql","nginx","php","redis"],"latest_commit_sha":null,"homepage":"https://garymeng.com/cn/2120.html","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garymengcom.png","metadata":{"files":{"readme":"README-all-en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"yeszao","custom":"https://paypal.me/mgzao"}},"created_at":"2017-04-22T10:38:18.000Z","updated_at":"2025-04-22T13:08:01.000Z","dependencies_parsed_at":"2023-12-05T02:25:38.934Z","dependency_job_id":"dbe7aaee-f641-4d11-b8c3-f993ddc2d07a","html_url":"https://github.com/garymengcom/dnmp","commit_stats":{"total_commits":527,"total_committers":45,"mean_commits":11.71111111111111,"dds":0.5806451612903225,"last_synced_commit":"1a6e715bc68496ac36dba97e7c1a3a0fdcb92dc4"},"previous_names":["garymengcom/dnmp","yeszao/dnmp"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Fdnmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Fdnmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Fdnmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Fdnmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garymengcom","download_url":"https://codeload.github.com/garymengcom/dnmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546077,"owners_count":21448260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","lnmp","lnmp-dockerfile","mysql","nginx","php","redis"],"created_at":"2025-01-28T13:08:41.452Z","updated_at":"2025-04-24T02:05:16.305Z","avatar_url":"https://github.com/garymengcom.png","language":"Shell","readme":"DNMP (Docker + Nginx/Openresty + MySQL5, 8 + PHP5, 7,8 + Redis + ElasticSearch + MongoDB + RabbitMQ) is a full-featured model**LNMP one-click installer with Support for Arm CPUs**。\n\n\u003e It is best to read it in advance before use[directory](#目录), in order to get started quickly, and problems can be eliminated in time.\n\nQQ Exchange Group:\n\n*   Group 1:**572041090**(Full)\n*   Group 2:**300723526**(Full)\n*   Group 3:**878913761**(bit)\n\n**[\\[ENGLISH\\]](README-en.md)** -\n[**\\[GitHub Address\\]**](https://github.com/yeszao/dnmp) -\n[**\\[Gitee address\\]**](https://gitee.com/yeszao/dnmp)\n\nDNMP Project Features:\n\n1.  `100%`open source\n2.  `100%`Follow docker standards\n3.  backing**Multiple versions of PHP**Coexistence, can be switched arbitrarily (PHP5.4, PHP5.6, PHP7.1, PHP7.2, PHP7.3, PHP7.4, PHP8.0)\n4.  Binding is supported**Any number of domain names**\n5.  backing**HTTPS and HTTP/2**\n6.  **PHP source code, MySQL data, configuration files, log files**All can be directly modified in Host\n7.  Built**Full PHP extension installation**command\n8.  Supported by default`pdo_mysql`、`mysqli`、`mbstring`、`gd`、`curl`、`opcache`and other commonly used and popular extensions, flexibly configured according to the environment\n9.  One-click selection of common services:\n    *   Multiple PHP versions: PHP5.4, PHP5.6, PHP7.0-7.4, PHP8.0\n    *   Web services: Nginx, Openresty\n    *   Databases: MySQL5, MySQL8, Redis, memcached, MongoDB, ElasticSearch\n    *   Message Queuing: RabbitMQ\n    *   Accessibility: Kibana, Logstash, phpMyAdmin, phpRedisAdmin, AdminMongo\n10. Apply in real projects, ensure`100%`available\n11. All mirrors originate from[Docker official repository](https://hub.docker.com), safe and reliable\n12. One configuration,**Windows、Linux、MacOs**All available\n13. Supports quick installation extension commands `install-php-extensions apcu`\n14. Supports installing CERTBOT to obtain SSL certificates for free https\n\n# directory\n\n*   [1. Directory structure](#1目录结构)\n*   [2. Quick to use](#2快速使用)\n*   [3.PHP and extensions](#3PHP和扩展)\n    *   [3.1 Switch the PHP version used by Nginx](#31-切换Nginx使用的PHP版本)\n    *   [3.2 Install PHP extensions](#32-安装PHP扩展)\n    *   [3.3 Quickly install php extensions](#33-快速安装php扩展)\n    *   [3.4 Using php command line in Host (php-cli)](#34-host中使用php命令行php-cli)\n    *   [3.5 Use commoser](#35-使用composer)\n*   [4. Administrative commands](#4管理命令)\n    *   [4.1 Server Startup and Build Commands](#41-服务器启动和构建命令)\n    *   [4.2 Add shortcut commands](#42-添加快捷命令)\n*   [5. Use Log](#5使用log)\n    *   [5.1 Nginx logs](#51-nginx日志)\n    *   [5.2 PHP-FPM logs](#52-php-fpm日志)\n    *   [5.3 MySQL logs](#53-mysql日志)\n*   [6. Database management](#6数据库管理)\n    *   [6.1 phpMyAdmin](#61-phpmyadmin)\n    *   [6.2 phpRedisAdmin](#62-phpredisadmin)\n*   [7. Safe to use in a formal environment](#7在正式环境中安全使用)\n*   [8. Frequently Asked Questions](#8常见问题)\n    *   [8.1 How to use curl in PHP code?](#81-如何在php代码中使用curl)\n    *   [8.2 Docker uses cron to time tasks](#82-Docker使用cron定时任务)\n    *   [8.3 Docker container time](#83-Docker容器时间)\n    *   [8.4 How to connect to MySQL and Redis servers](#84-如何连接MySQL和Redis服务器)\n\n## 1. Directory structure\n\n    /\n    ├── data                        数据库数据目录\n    │   ├── esdata                  ElasticSearch 数据目录\n    │   ├── mongo                   MongoDB 数据目录\n    │   ├── mysql                   MySQL8 数据目录\n    │   └── mysql5                  MySQL5 数据目录\n    ├── services                    服务构建文件和配置文件目录\n    │   ├── elasticsearch           ElasticSearch 配置文件目录\n    │   ├── mysql                   MySQL8 配置文件目录\n    │   ├── mysql5                  MySQL5 配置文件目录\n    │   ├── nginx                   Nginx 配置文件目录\n    │   ├── php                     PHP5.6 - PHP7.4 配置目录\n    │   ├── php54                   PHP5.4 配置目录\n    │   └── redis                   Redis 配置目录\n    ├── logs                        日志目录\n    ├── docker-compose.sample.yml   Docker 服务配置示例文件\n    ├── env.smaple                  环境配置示例文件\n    └── www                         PHP 代码目录\n\n## 2. Quick to use\n\n1.  Local installation\n    *   `git`\n    *   `Docker`(The system needs to be Linux, Windows 10 Build 15063+, or MacOS 10.12+, and must be.)`64`bit)\n    *   `docker-compose 1.7.0+`\n2.  `clone`Project:\n        $ git clone https://github.com/yeszao/dnmp.git\n        # 假如速度太慢，可以使用加速拉取镜像\n        $ git clone https://github.com.cnpmjs.org/yeszao/dnmp.git\n3.  If the host is a Linux system and the current user is not`root`Users, you also need to join the current user`docker`User Groups:\n        $ sudo gpasswd -a ${USER} docker\n4.  Copy and name the configuration file (for Windows systems.)`copy`command), start:\n        $ cd dnmp                                           # 进入项目目录\n        $ cp env.sample .env                                # 复制环境变量文件\n        $ cp docker-compose.sample.yml docker-compose.yml   # 复制 docker-compose 配置文件。默认启动3个服务：\n                                                            # Nginx、PHP7和MySQL8。要开启更多其他服务，如Redis、\n                                                            # PHP5.6、PHP5.4、MongoDB，ElasticSearch等，请删\n                                                            # 除服务块前的注释\n        $ docker-compose up                                 # 启动\n5.  Access in a browser:`http://localhost`or`https://localhost`(Self-signed HTTPS demo) can see the effect of PHP code in the file`./www/localhost/index.php`。\n\n## 3.PHP and extensions\n\n### 3.1 Switch the PHP version used by Nginx\n\nFirst, you need to start another version of PHP, such as PHP 5.4, so that's the first step`docker-compose.yml`Delete the comments that preceded PHP5.4 from the file and start the PHP5.4 container.\n\nAfter PHP5.4 starts, open Nginx Configuration and modify it`fastcgi_pass`The host address of the company, by `php`to`php54`As follows:\n\n        fastcgi_pass   php:9000;\n\nFor:\n\n        fastcgi_pass   php54:9000;\n\nthereinto `php` and `php54` be`docker-compose.yml`The name of the server in the file.\n\nAt last**Reboot Nginx** Take effect.\n\n```bash\n$ docker exec -it nginx nginx -s reload\n```\n\nHere are two`nginx`, the first is the container name, and the second is in the container`nginx`Procedure.\n\n### 3.2 Install PHP extensions\n\nMany of php's features are implemented through extensions, and installing extensions is a slightly time-consuming process.\nSo, in addition to the PHP built-in extension, in`env.sample`In the file we only install a small number of extensions by default,\nIf you want to install more extensions, open yours`.env`Modify the following PHP configuration,\nAdd the required PHP extensions:\n\n```bash\nPHP_EXTENSIONS=pdo_mysql,opcache,redis       # PHP 要安装的扩展列表，英文逗号隔开\nPHP54_EXTENSIONS=opcache,redis                 # PHP 5.4要安装的扩展列表，英文逗号隔开\n```\n\nThen re-build the PHP image.\n\n```bash\ndocker-compose build php\n```\n\nSee the available extensions in the same file`env.sample`Comment block description.\n\n### 3.3 Quickly install php extensions\n\n1\\. Enter the container:\n\n```sh\ndocker exec -it php /bin/sh\n\ninstall-php-extensions apcu \n```\n\n2\\. Support quick installation extension list\n\n\u003c!-- START OF EXTENSIONS TABLE --\u003e\n\n\u003c!-- ########################################################### --\u003e\n\n\u003c!-- #                                                         # --\u003e\n\n\u003c!-- #  DO NOT EDIT THIS TABLE: IT IS GENERATED AUTOMATICALLY  # --\u003e\n\n\u003c!-- #                                                         # --\u003e\n\n\u003c!-- #  EDIT THE data/supported-extensions FILE INSTEAD        # --\u003e\n\n\u003c!-- #                                                         # --\u003e\n\n\u003c!-- ########################################################### --\u003e\n\n| Extension | PHP 5.5 | PHP 5.6 | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | PHP 8.0 | PHP 8.1 |\n|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n| amqp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| apcu | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| apcu_bc |  |  | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| ast |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| bcmath | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| blackfire | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| bz2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| calendar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| cmark |  |  | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| csv |  |  |  |  |  | ✓ | ✓ | ✓ | ✓ |\n| dba | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| decimal |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ds |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| enchant | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ev | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| event | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| excimer |  |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| exif | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ffi |  |  |  |  |  |  | ✓ | ✓ | ✓ |\n| gd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| gearman | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |\n| geoip | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| geospatial | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| gettext | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| gmagick | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| gmp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| gnupg | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| grpc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| http | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| igbinary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| imagick | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| imap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| inotify | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| interbase | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |  |\n| intl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ioncube_loader | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| jsmin | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| json_post | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ldap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| lzf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| mailparse | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| maxminddb |  |  |  |  | ✓ | ✓ | ✓ | ✓ | ✓ |\n| mcrypt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| memcache | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| memcached | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| mongo | ✓ | ✓ |  |  |  |  |  |  |  |\n| mongodb | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| mosquitto | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| msgpack | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| mssql | ✓ | ✓ |  |  |  |  |  |  |  |\n| mysql | ✓ | ✓ |  |  |  |  |  |  |  |\n| mysqli | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| oauth | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| oci8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| odbc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| opcache | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| opencensus |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| openswoole |  |  |  |  | ✓ | ✓ | ✓ | ✓ | ✓ |\n| parallel[\\*](#special-requirements-for-parallel) |  |  |  | ✓ | ✓ | ✓ | ✓ |  |  |\n| pcntl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pcov |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_dblib | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |\n| pdo_firebird | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_mysql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_oci |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_odbc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pdo_sqlsrv[\\*](#special-requirements-for-pdo_sqlsrv) |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| propro | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| protobuf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |\n| pspell | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| pthreads[\\*](#special-requirements-for-pthreads) | ✓ | ✓ | ✓ |  |  |  |  |  |  |\n| raphf | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| rdkafka | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| recode | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |  |\n| redis | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| seaslog | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| shmop | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| smbclient | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| snmp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| snuffleupagus |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| soap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sockets | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| solr | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sourceguardian | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |\n| spx |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sqlsrv[\\*](#special-requirements-for-sqlsrv) |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| ssh2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| stomp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |\n| swoole | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sybase_ct | ✓ | ✓ |  |  |  |  |  |  |  |\n| sysvmsg | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sysvsem | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| sysvshm | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| tensor[\\*](#special-requirements-for-tensor) |  |  |  |  | ✓ | ✓ | ✓ | ✓ |  |\n| tidy | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| timezonedb | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| uopz | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| uploadprogress | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| uuid | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| vips[\\*](#special-requirements-for-vips) |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| wddx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |  |  |  |\n| xdebug | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| xhprof | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| xlswriter |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| xmldiff | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| xmlrpc | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| xsl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| yac |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| yaml | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| yar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| zephir_parser |  |  | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| zip | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| zookeeper | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n| zstd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |\n\n*Number of supported extensions: 116*\n\nThis extension comes from\u003chttps://github.com/mlocati/docker-php-extension-installer\u003e\nRefer to the sample files\n\n### 3.4 Using php command line in Host (php-cli)\n\n1.  reference[bash.alias.sample](bash.alias.sample)Sample file, copy the corresponding php cli function to the host `~/.bashrc`File.\n2.  To make a file work:\n    ```bash\n    source ~/.bashrc\n    ```\n3.  You can then execute php commands in the host:\n    ```bash\n    ~ php -v\n    PHP 7.2.13 (cli) (built: Dec 21 2018 02:22:47) ( NTS )\n    Copyright (c) 1997-2018 The PHP Group\n    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\n        with Zend OPcache v7.2.13, Copyright (c) 1999-2018, by Zend Technologies\n        with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans\n    ```\n\n### 3.5 Use commoser\n\n**Method 1: Use the compare command in the host**\n\n1.  Determine the path to the compiler cache. For example, my dnmp download is in`~/dnmp`directory, that compiler's cache path is`~/dnmp/data/composer`。\n2.  reference[bash.alias.sample](bash.alias.sample)A sample file that copies the corresponding php composer function to the host `~/.bashrc`File.\n    \u003e It is important to note here that the sample file is in`~/dnmp/data/composer`The directory needs to be the directory identified in the first step.\n3.  To make a file work:\n    ```bash\n    source ~/.bashrc\n    ```\n4.  You can use a composer in any directory on the host:\n    ```bash\n    cd ~/dnmp/www/\n    composer create-project yeszao/fastphp project --no-dev\n    ```\n5.  Optionally, the first time you use composer, it will be `~/dnmp/data/composer` Generate one under the directory**config.json**file, in which you can specify a domestic repository, for example:\n    ```json\n    {\n        \"config\": {},\n        \"repositories\": {\n            \"packagist\": {\n                \"type\": \"composer\",\n                \"url\": \"https://mirrors.aliyun.com/composer/\"\n            }\n        }\n    }\n\n    ```\n\n**Method 2: Use the composer command inside the container**\n\nThere is another way, which is to go into the container and execute`composer`Command, using the PHP7 container as an example:\n\n```bash\ndocker exec -it php /bin/sh\ncd /www/localhost\ncomposer update\n```\n\n## 4. Administrative commands\n\n### 4.1 Server Startup and Build Commands\n\nTo manage services, follow the command with the server name, for example:\n\n```bash\n$ docker-compose up                         # 创建并且启动所有容器\n$ docker-compose up -d                      # 创建并且后台运行方式启动所有容器\n$ docker-compose up nginx php mysql         # 创建并且启动nginx、php、mysql的多个容器\n$ docker-compose up -d nginx php  mysql     # 创建并且已后台运行的方式启动nginx、php、mysql容器\n\n\n$ docker-compose start php                  # 启动服务\n$ docker-compose stop php                   # 停止服务\n$ docker-compose restart php                # 重启服务\n$ docker-compose build php                  # 构建或者重新构建服务\n\n$ docker-compose rm php                     # 删除并且停止php容器\n$ docker-compose down                       # 停止并删除容器，网络，图像和挂载卷\n```\n\n### 4.2 Add shortcut commands\n\nAt the time of development, we may use it often`docker exec -it`Entering the container and aliasing the commands commonly used is a convenient way to do so.\n\nFirst, review the available containers in the host:\n\n```bash\n$ docker ps           # 查看所有运行中的容器\n$ docker ps -a        # 所有容器\n```\n\nOutput`NAMES`That column is the name of the container, or if the default configuration is used, then the name is`nginx`、`php`、`php56`、`mysql`Wait.\n\nThen, open`~/.bashrc`or`~/.zshrc`file, plus:\n\n```bash\nalias dnginx='docker exec -it nginx /bin/sh'\nalias dphp='docker exec -it php /bin/sh'\nalias dphp56='docker exec -it php56 /bin/sh'\nalias dphp54='docker exec -it php54 /bin/sh'\nalias dmysql='docker exec -it mysql /bin/bash'\nalias dredis='docker exec -it redis /bin/sh'\n```\n\nThe next time you enter the container, it is very fast, such as entering the php container:\n\n```bash\n$ dphp\n```\n\n### 4.3 View docker networks\n\n```sh\nifconfig docker0\n```\n\nFor filling in`extra_hosts`The container accesses the host`hosts`address\n\n## 5. Use Log\n\nThe location where the log file is generated depends on the value of each log configuration under conf.\n\n### 5.1 Nginx logs\n\nNginx logs are the logs we use the most, so we put them separately in the root directory`log`Under.\n\n`log`The directory will be mapped for the Nginx container`/var/log/nginx`directory, so in the Nginx configuration file, the location of the output log needs to be configured`/var/log/nginx`Directories, such as:\n\n    error_log  /var/log/nginx/nginx.localhost.error.log  warn;\n\n### 5.2 PHP-FPM logs\n\nIn most cases, PHP-FPM logs are output to Nginx's logs, so no additional configuration is required.\n\nIn addition, it is recommended to open the error log directly in PHP:\n\n```php\nerror_reporting(E_ALL);\nini_set('error_reporting', 'on');\nini_set('display_errors', 'on');\n```\n\nIf you really need it, you can open it (in a container) by following the steps below.\n\n1.  Go to the container, create a log file, and modify the permissions:\n    ```bash\n    $ docker exec -it php /bin/sh\n    $ mkdir /var/log/php\n    $ cd /var/log/php\n    $ touch php-fpm.error.log\n    $ chmod a+w php-fpm.error.log\n    ```\n2.  Open and modify the configuration file for PHP-FPM on the host`conf/php-fpm.conf`, find the following line, delete the comment, and change the value to:\n        php_admin_value[error_log] = /var/log/php/php-fpm.error.log\n3.  Restart the PHP-FPM container.\n\n### 5.3 MySQL logs\n\nBecause MySQL in the MySQL container is used`mysql`The user starts, it cannot be self-contained`/var/log`Add log files under Add log files. So, we put mySQL logs in the same directory as data, i.e. projects`mysql`directory, corresponding to the container`/var/log/mysql/`Directory.\n\n```bash\nslow-query-log-file     = /var/log/mysql/mysql.slow.log\nlog-error               = /var/log/mysql/mysql.error.log\n```\n\nThe above is the configuration of the log file in mysql.conf.\n\n## 6. Database management\n\nThis project defaults to `docker-compose.yml`For MySQL online management is not turned on*phpMyAdmin*, and for redis online management*phpRedisAdmin*, which can be modified or deleted as needed.\n\n### 6.1 phpMyAdmin\n\nThe port address of the phpMyAdmin container mapped to the host is:`8080`, so the address on the host to access phpMyAdmin is:\n\n    http://localhost:8080\n\nMySQL connection information:\n\n*   host: (MySQL container network for this project)\n*   port：`3306`\n*   username:(Manually entered in the phpmyadmin interface)\n*   password:(Manually entered in the phpmyadmin interface)\n\n### 6.2 phpRedisAdmin\n\nThe port address of the phpRedisAdmin container mapped to the host is:`8081`, so the address on the host to access phpMyAdmin is:\n\n    http://localhost:8081\n\nThe Redis connection information is as follows:\n\n*   host: (Redis Container Network for this project)\n*   port: `6379`\n\n## 7. Safe to use in a formal environment\n\nTo use in a formal environment, please:\n\n1.  Turn off XDebug debugging in php .ini\n2.  Security policies to enhance Access to MySQL databases\n3.  Enhanced security policies for redis access\n\n## 8 Frequently Asked Questions\n\n### 8.1 How to use curl in PHP code?\n\nRefer to this issue:\u003chttps://github.com/yeszao/dnmp/issues/91\u003e\n\n### 8.2 Docker uses cron to time tasks\n\n[Docker uses cron to time tasks](https://www.awaimai.com/2615.html)\n\n### 8.3 Docker container time\n\nThe container time is configured in an .env file`TZ`For variables, see all supported time zones[List of time zones on Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)or[List of time zones supported by PHP· PHP official website](https://www.php.net/manual/zh/timezones.php)。\n\n### 8.4 How to connect to MySQL and Redis servers\n\nThere are two cases of this.\n\nThe first case, in**PHP code**。\n\n```php\n// 连接MySQL\n$dbh = new PDO('mysql:host=mysql;dbname=mysql', 'root', '123456');\n\n// 连接Redis\n$redis = new Redis();\n$redis-\u003econnect('redis', 6379);\n```\n\nBecause containers are containers`expose`The ports are connected, and they are in the same one`networks`down, so connected`host`Parameters directly with the container name,`port`The parameter is the port inside the container. Please refer to it for more[The Difference Between Docker-compose Ports and Expo](https://www.awaimai.com/2138.html)。\n\nIn the second case,**In the host**Pass**command line**or**Navicat**and other tools connected. For the host to connect mysql and redis, the container must pass through`ports`The port is mapped to the host. Take mysql as an example.`docker-compose.yml`There is such a thing in the document`ports`Disposition:`3306:3306`, that is, the 3306 port of the host and the 3306 port of the container form a map, so we can connect like this:\n\n```bash\n$ mysql -h127.0.0.1 -uroot -p123456 -P3306\n$ redis-cli -h127.0.0.1\n```\n\nOver here`host`The parameter cannot be used localhost because it communicates with mysql through the sock file by default, and the container is isolated from the host file system, so it needs to be connected via TCP, so you need to specify the IP.\n\n### 8.5 How php in a container connects to host MySQL\n\n1\\. Host execution`ifconfig docker0`get`inet`It's about connecting`ip`address\n\n```sh\n$ ifconfig docker0\ndocker0: flags=4099\u003cUP,BROADCAST,MULTICAST\u003e  mtu 1500\n        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255\n        ...\n```\n\n2\\. Run the host Mysql command line\n\n```mysql\n mysql\u003eGRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;\n mysql\u003eflush privileges;\n// 其中各字符的含义：\n// *.* 对任意数据库任意表有效\n// \"root\" \"123456\" 是数据库用户名和密码\n// '%' 允许访问数据库的IP地址，%意思是任意IP，也可以指定IP\n// flush privileges 刷新权限信息\n```\n\n3\\. Then use the php container directly`172.0.17.1:3306`Just connect\n\n### 8.6 SQLSTATE\\[HY000] \\[1130] Host '172.19.0.2' is not allowed to connect to this MySQL server\n\n1.  Currently using mysql-server `8.0.28`The above version, php version is required`7.4.7`The above can only be connected\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/yeszao","https://paypal.me/mgzao"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarymengcom%2Fdnmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarymengcom%2Fdnmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarymengcom%2Fdnmp/lists"}