{"id":13564920,"url":"https://github.com/guanguans/dnmp-plus","last_synced_at":"2025-07-04T05:08:31.440Z","repository":{"id":47026673,"uuid":"178793073","full_name":"guanguans/dnmp-plus","owner":"guanguans","description":"🐳 Docker 的 LNMP 一键安装开发环境 + PHP 非侵入式监控平台 xhgui。","archived":false,"fork":false,"pushed_at":"2021-09-08T03:46:37.000Z","size":6619,"stargazers_count":301,"open_issues_count":0,"forks_count":64,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-02T18:17:36.067Z","etag":null,"topics":["dnmp","docker","tideways","xhgui","xhprof"],"latest_commit_sha":null,"homepage":"https://guanguans.github.io/dnmp-plus","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/guanguans.png","metadata":{"files":{"readme":"README-EN.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"guanguans","custom":"https://github.com/guanguans/guanguans.github.io/blob/master/images/wechat.jpeg"}},"created_at":"2019-04-01T05:41:24.000Z","updated_at":"2025-03-27T09:11:58.000Z","dependencies_parsed_at":"2022-08-26T09:40:51.329Z","dependency_job_id":null,"html_url":"https://github.com/guanguans/dnmp-plus","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guanguans/dnmp-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fdnmp-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fdnmp-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fdnmp-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fdnmp-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guanguans","download_url":"https://codeload.github.com/guanguans/dnmp-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fdnmp-plus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263450011,"owners_count":23468153,"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":["dnmp","docker","tideways","xhgui","xhprof"],"created_at":"2024-08-01T13:01:37.953Z","updated_at":"2025-07-04T05:08:31.420Z","avatar_url":"https://github.com/guanguans.png","language":"Shell","funding_links":["https://patreon.com/guanguans","https://github.com/guanguans/guanguans.github.io/blob/master/images/wechat.jpeg"],"categories":["Shell"],"sub_categories":[],"readme":"# DNMP PLUS\n\n**dnmp** = `Docker` + `Nginx` + `MySQL` + `PHP` + `Redis` + `MongDB`\n\n**plus** = `xhgui` + `xhprof` + `tideways`\n\n**dnmp-plus** = `PHPer's one-click installation development environment` + `PHP non-intrusive monitoring platform(optimizing system performance, positioning artifacts of Bug)`\n\n---\n\n[![Build Status](https://app.travis-ci.com/guanguans/dnmp-plus.svg?branch=master)](https://app.travis-ci.com/guanguans/dnmp-plus)\n\n[简体中文](README.md) | English\n\n**[dnmp-plus](https://github.com/guanguans/dnmp-plus)** is added on the basis of dnmp:\n\n* [PHP xhprof extension](https://github.com/phacility/xhprof) - PHP performance tracking and analysis tool developed by Facebook\n* [PHP tideways extension](https://github.com/tideways/php-xhprof-extension) - branch of xhprof with support for PHP7\n* PHP mongodb extension\n* MongoDB service\n* Mongo Express - MongoDB Service Management System\n* [Xhgui](https://github.com/perftools/xhgui) - xhprof GUI system for analyzing data data\n\n![](docs/dnmp-plus.png)\n\n---\n\n## Directory Structure\n\n``` bash\n├── .github                     Github 配置目录\n├── conf                        配置文件目录\n│   ├── conf.d                  Nginx 用户站点配置目录\n│   ├── mysql.cnf               MySQL 用户配置文件\n│   ├── nginx.conf              Nginx 默认配置文件\n│   ├── php-fpm.conf            PHP-FPM 配置文件\n│   ├── php.ini                 PHP 配置文件\n│   ├── redis.conf              Redis 配置文件\n├── docs                        文档目录\n├── extensions                  PHP 扩展源码包\n├── log                         日志目录\n├── mongo                       MongoDB 数据目录\n├── mysql                       MySQL 数据目录\n├── www                         PHP 代码目录\n├── Dockerfile                  PHP 镜像构建文件\n├── docker-compose-sample.yml   Docker 服务配置示例文件\n├── env.smaple                  环境配置示例文件\n└── travis-build.sh             Travis CI 构建脚本\n```\n\n## Environmental requirements\n\n* Docker\n* Docker-compose\n* Git\n\n## Quick use\n\n``` bash\n$ git clone https://github.com/guanguans/dnmp-plus.git --recursive\n$ cd dnmp-plus\n$ cp env.sample .env\n$ cp docker-compose-sample.yml docker-compose.yml\n# Service option：nginx、php72、php56、mysql、mongo、redis、phpmyadmin、phpredisadmin、mongo-express\n$ docker-compose up -d php72 nginx mysql mongo\n```\n\nOK, you now have a dnmp-plus development environment, the default web root directory `www/localhost/`, the browser accesses http://localhost\n\n![](docs/localhost.png)\n\n## Basic use\n\n``` bash\n# Service option：nginx、php72、php56、mysql、mongo、redis、phpmyadmin、phpredisadmin、mongo-express\n\n# Create and start containers\n$ docker-compose up 服务1 服务2 ...\n# Create and start all containers\n$ docker-compose up\n# Create and start deamon containers \n$ docker-compose up -d 服务1 服务2 ...\n\n# Start services\n$ docker-compose start 服务1 服务2 ...\n\n# Stop services\n$ docker-compose stop 服务1 服务2 ...\n\n# Restart services\n$ docker-compose restart 服务1 服务2 ...\n\n# Build or rebuild services\n$ docker-compose build 服务1 服务2 ...\n\n# Execute a command in a running container\n$ docker-compose exec 服务 bash\n\n# Remove stopped containers\n$ docker-compose rm 服务1 服务2 ...\n\n# Stop and remove containers, networks, images, and volumes\n$ docker-compose down 服务1 服务2 ...\n```\n\n## For xhgui use, you can refer to https://github.com/guanguans/guanguans.github.io/issues/9\ninstallation\n\n### Installation\n\n``` bash\n$ cd www/xhgui-branch\n$ composer install\n```\n\n### Modify the xhgui-branch configuration file `www/xhgui-branch/config/config.default.php`\n\n``` php\n\u003c?php\nreturn array(\n    ...\n    'debug'        =\u003e true, // changed to true for easy debugging\n    'mode'         =\u003e 'development',\n    ...\n    'extension'    =\u003e 'tideways', // changed to support tideways for PHP7\n    ...\n    'save.handler' =\u003e 'mongodb',\n    'db.host'      =\u003e 'mongodb://mongo:27017', // 127.0.0.1 changed to mongo\n    ...\n);\n```\n\n### Added in the hosts file\n\n``` bash\n127.0.0.1             xhgui.test\n```\n\n### Browser access http://xhgui.test\n\n![](docs/xhgui1.png)\n\n### Modify in the nginx configuration file to analyze the project, with the default localhost configuration `conf/conf.d/localhost.conf` as an example\n\n``` conf\n...\nlocation ~ \\.php$ {\n    fastcgi_pass   php72:9000;\n    fastcgi_index  index.php;\n    include        fastcgi_params;\n    fastcgi_param  PATH_INFO $fastcgi_path_info;\n    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n    # 在执行主程序之前运行我们指定的PHP脚本\n    fastcgi_param  PHP_VALUE \"auto_prepend_file=/var/www/html/xhgui-branch/external/header.php\"; \n}\n...\n``` \n\n### Restart nginx\n\n``` bash\n$ docker-compose restart nginx\n```\n\n### The browser visits http://localhost](http://localhost) and then visits [http://xhgui.test](http://xhgui.test). Now that you have the content, you can enjoy the performance tracking and analysis of the project\n\n![](docs/xhgui2.png)\n\n![](docs/xhgui3.png)\n\n## PHP and extensions\n\n### Switch the PHP version used by Nginx\n\nBy default, both PHP5.6 and PHP7.2 2 PHP versions of the container are created. Switching PHP only needs to modify the `fastcgi_pass` option of the corresponding site Nginx configuration. For example, the example [http://localhost](http://localhost) uses PHP7.2, Nginx configuration:\n\n``` conf\nfastcgi_pass   php72:9000;\n```\n\nTo use PHP 5.6 instead, change it to:\n\n``` conf\nfastcgi_pass   php56:9000;\n```\n\nRestart Nginx to take effect\n\n``` bash\n$ docker-compose restart nginx\n```\n\n### Install PHP extensions\n\nMany of PHP's features are implemented through extensions, and installing extensions is a slightly time-consuming process, so in addition to the PHP built-in extensions, we only install a few extensions by default in the `env.sample` file. If you want to install more extensions, please Open your `.env` file and modify the PHP configuration as follows to add the required PHP extensions:\n\n``` bash\nPHP72_EXTENSIONS=pdo_mysql,opcache,redis,xdebug,mongodb,tideways\nPHP56_EXTENSIONS=opcache,redis,xdebug,mongodb,xhprof\n```\n\nThen rebuild the PHP image\n\n``` bash\ndocker-compose build php72\ndocker-compose up -d\n```\n\n## Use Log\n\nThe location where the Log file is generated depends on the value of each log configuration under conf.\n\n### Nginx Log\n\nThe Nginx log is the one we use the most, so we put it under the root directory `log`. The `log` directory maps the /var/log/nginx directory of the Nginx container, so in the Nginx configuration file, you need to output the location of the log. We need to configure it to the `/var/log/nginx` directory, such as:\n\n``` conf\nerror_log  /var/log/nginx/nginx.localhost.error.log  warn;\n```\n\n### MySQL log\n\nBecause MySQL in the MySQL container uses the `mysql` user to start, it cannot add log files by itself under `/var/log`. So, we put the MySQL log in the same directory as data, the `mysql` directory of the project, corresponding to the `/var/lib/mysql/` directory in the container.\n\nConfiguration of the log file in mysql.conf:\n\n``` conf\nslow-query-log-file     = /var/lib/mysql/mysql.slow.log\nlog-error               = /var/lib/mysql/mysql.error.log\n```\n\n## Database management\n\n* Default phpMyAdmin address: http://localhost:8080\n* Default phpRedisAdmin address: http://localhost:8081\n* Default Mongo Express address: http://localhost:8082\n\n## Reference link\n\n* [https://github.com/yeszao/dnmp](https://github.com/yeszao/dnmp)，yeszao\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanguans%2Fdnmp-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguanguans%2Fdnmp-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanguans%2Fdnmp-plus/lists"}