dnmp is a free, open source databases project written in Shell and released under MIT. It has 4,089 GitHub stars, 1,410 forks and 48 open issues, and was last pushed 9 days ago. On this registry it ranks #164 of 203 tracked projects in Databases, with 5 head-to-head comparisons available.

What is dnmp?

DNMP is an MIT-licensed Docker-based LNMP one-click installer that bundles Nginx or OpenResty, MySQL 5 and 8, multiple PHP versions, Redis and a range of optional data services into a single reproducible stack, aimed at PHP developers and small teams who want the same environment on Windows, Linux and macOS without assembling each service by hand.

What it is

DNMP combines Docker with Nginx or Openresty, MySQL 5 and 8, PHP 5, 7 and 8, Redis, ElasticSearch, MongoDB and RabbitMQ. It is described as a full-featured LNMP one-click installer that supports Arm CPUs, written in Shell and released under the MIT licence. All images come from the Docker official repository, and the project states that it follows the Docker standard fully. It is listed in this registry under Infrastructure & Operations / Databases, with topics covering docker, lnmp, lnmp-dockerfile, mysql, nginx, php and redis.

The concrete problem it solves is the manual assembly of an LNMP environment. Instead of installing and configuring Nginx, several PHP versions, MySQL, Redis and assorted extensions separately, and then repeating that work on every machine, DNMP expresses the whole stack in a docker-compose.yml and an .env file. PHP source code, MySQL data, configuration files and log files are all visible and editable directly on the host, so the working environment stays close to the development environment. Multiple PHP versions coexist and can be switched by editing a single fastcgi_pass line.

Key capabilities

  • Multi-version PHP coexistence spanning PHP 5.4, 5.6, 7.0 through 7.4 and 8.0, switched by changing Nginx's fastcgi_pass from php:9000 to php54:9000 and reloading with docker exec -it nginx nginx -s reload.
  • One-click optional service blocks in docker-compose.yml for MySQL 5, MySQL 8, Redis, memcached, MongoDB, ElasticSearch and RabbitMQ, plus Nginx or Openresty as the web tier.
  • Bundled administration tools including Kibana, Logstash, phpMyAdmin, phpRedisAdmin and AdminMongo.
  • Default PHP extensions of pdo_mysql, mysqli, mbstring, gd, curl and opcache, extended by editing PHP_EXTENSIONS in .env and rebuilding with docker-compose build php.
  • In-container extension installs through install-php-extensions apcu.
  • HTTPS and HTTP/2 support with arbitrary domain binding, plus certbot for free SSL certificates.
  • Host-visible layout with /data for MySQL, MySQL5, MongoDB and ElasticSearch data, /logs for logs, /services for per-service configuration and /www for PHP code.

Who uses it and how

  • PHP developers who need one configuration to work across Windows 10 Build 15063+, macOS 10.12+ and Linux, and who must not maintain three separate environments.
  • Teams running legacy PHP 5.4 or 5.6 applications beside newer PHP 7.x or 8.0 services on the same host, including on Arm CPUs.
  • Projects that need MySQL alongside Redis, MongoDB, ElasticSearch or RabbitMQ and want the accompanying admin UIs (phpMyAdmin, phpRedisAdmin, AdminMongo, Kibana) available from the same compose file.
  • Operators deploying to a server who want database data, logs and configuration mounted from the host for direct inspection and editing.

Getting started

Clone the repository, copy env.sample to .env and docker-compose.sample.yml to docker-compose.yml, then run docker-compose up, which starts Nginx, PHP 7 and MySQL 8 by default and serves a starting page at http://localhost. Docker and docker-compose 1.7.0+ are required.

How it compares

The provided facts list no paid products that DNMP replaces, and they name no similar LNMP stacks. On the evidence available, DNMP stands alone in this registry as the only Docker-based LNMP one-click installer of its kind.

When to use it — and when not to

A self-hoster must operate the MySQL, Redis, MongoDB, ElasticSearch and RabbitMQ containers, the Nginx and PHP-FPM tiers, host-mounted data and log directories, and the .env and docker-compose.yml files that tie them together. The project documentation is primarily in Chinese and the supplied README excerpt is truncated, so English-only teams may find setup guidance thinner than the feature list suggests. It is also a poor fit for anyone who wants a managed database or who cannot run Docker and docker-compose on the host.

project readme (upstream, from github) — read inline

DNMP(Docker + Nginx/Openresty + MySQL5,8 + PHP5,7,8 + Redis + ElasticSearch + MongoDB + RabbitMQ)是一款全功能的LNMP一键安装程序,支持Arm CPU

找远程工作,推荐远程岛

项目地址
QQ交流群
  • 1群:572041090(已满)
  • 2群:300723526(已满)
  • 3群:878913761(已满)
  • 4群:850756381(有位)
DNMP项目特点
  1. 100%开源
  2. 100%遵循Docker标准
  3. 支持多版本PHP共存,可任意切换(PHP5.4、PHP5.6、PHP7.1、PHP7.2、PHP7.3、PHP7.4、PHP8.0)
  4. 支持绑定任意多个域名
  5. 支持HTTPS和HTTP/2
  6. PHP源代码、MySQL数据、配置文件、日志文件都可在Host中直接修改查看
  7. 内置完整PHP扩展安装命令
  8. 默认支持pdo_mysqlmysqlimbstringgdcurlopcache等常用热门扩展,根据环境灵活配置
  9. 可一键选配常用服务:
    • 多PHP版本:PHP5.4、PHP5.6、PHP7.0-7.4、PHP8.0
    • Web服务:Nginx、Openresty
    • 数据库:MySQL5、MySQL8、Redis、memcached、MongoDB、ElasticSearch
    • 消息队列:RabbitMQ
    • 辅助工具:Kibana、Logstash、phpMyAdmin、phpRedisAdmin、AdminMongo
  10. 实际项目中应用,确保100%可用
  11. 所有镜像源于Docker官方仓库,安全可靠
  12. 一次配置,Windows、Linux、MacOs皆可用
  13. 支持快速安装扩展命令 install-php-extensions apcu
  14. 支持安装certbot获取免费https用的SSL证书

目录

1.目录结构

/
├── data                        数据库数据目录
│   ├── esdata                  ElasticSearch 数据目录
│   ├── mongo                   MongoDB 数据目录
│   ├── mysql                   MySQL8 数据目录
│   └── mysql5                  MySQL5 数据目录
├── services                    服务构建文件和配置文件目录
│   ├── elasticsearch           ElasticSearch 配置文件目录
│   ├── mysql                   MySQL8 配置文件目录
│   ├── mysql5                  MySQL5 配置文件目录
│   ├── nginx                   Nginx 配置文件目录
│   ├── php                     PHP5.6 - PHP7.4 配置目录
│   ├── php54                   PHP5.4 配置目录
│   └── redis                   Redis 配置目录
├── logs                        日志目录
├── docker-compose.sample.yml   Docker 服务配置示例文件
├── env.smaple                  环境配置示例文件
└── www                         PHP 代码目录

2.快速使用

1. 本地安装

- `git`
- `Docker`(系统需为Linux,Windows 10 Build 15063+,或MacOS 10.12+,且必须要`64`位)
- `docker-compose 1.7.0+`

2. clone项目:

```
$ git clone https://github.com/yeszao/dnmp.git
```

3. 如果主机是 Linux系统,且当前用户不是root用户,还需将当前用户加入docker用户组:

```
$ sudo gpasswd -a ${USER} docker
```

4. 拷贝并命名配置文件(Windows系统请用copy命令),启动:

```
$ cd dnmp                                           # 进入项目目录
$ cp env.sample .env                                # 复制环境变量文件。note:安装php扩展请查看文档中的3.2小节
$ cp docker-compose.sample.yml docker-compose.yml   # 复制 docker-compose 配置文件。默认启动3个服务:
                                                    # Nginx、PHP7和MySQL8。要开启更多其他服务,如Redis、
                                                    # PHP5.6、PHP5.4、MongoDB,ElasticSearch等,请删
                                                    # 除服务块前的注释
$ docker-compose up                                 # 启动
```
5. 在浏览器中访问:http://localhosthttps://localhost(自签名HTTPS演示)就能看到效果,PHP代码在文件./www/localhost/index.php

3.PHP和扩展

3.1 切换Nginx使用的PHP版本

首先,需要启动其他版本的PHP,比如PHP5.4,那就先在docker-compose.yml文件中删除PHP5.4前面的注释,再启动PHP5.4容器。

PHP5.4启动后,打开Nginx 配置,修改fastcgi_pass的主机地址,由php改为php54,如下:

    fastcgi_pass   php:9000;

为:

    fastcgi_pass   php54:9000;

其中 phpphp54docker-compose.yml文件中服务器的名称。

最后,重启 Nginx 生效。

$ docker exec -it nginx nginx -s reload

这里两个nginx,第一个是容器名,第二个是容器中的nginx程序。

3.2 安装PHP扩展

PHP的很多功能都是通过扩展实现,而安装扩展是一个略费时间的过程, 所以,除PHP内置扩展外,在env.sample文件中我们仅默认安装少量扩展, 如果要安装更多扩展,请打开你的.env文件修改如下的PHP配置, 增加需要的PHP扩展:

PHP_EXTENSIONS=pdo_mysql,opcache,redis       # PHP 要安装的扩展列表,英文逗号隔开
PHP54_EXTENSIONS=opcache,redis                 # PHP 5.4要安装的扩展列表,英文逗号隔开

然后重新build PHP镜像。

docker-compose build php

可用的扩展请看同文件的env.sample注释块说明。

3.3 快速安装php扩展

1.进入容器:

docker exec -it php /bin/sh

install-php-extensions apcu 

2.支持快速安装扩展列表

Supported PHP extensions

Extension PHP 8.5 PHP 8.4 PHP 8.3 PHP 8.2 PHP 8.1 PHP 8.0 PHP 7.4 PHP 7.3 PHP 7.2 PHP 7.1 PHP 7.0 PHP 5.6 PHP 5.5
amqp
apcu
apcu_bc
ast
bcmath
bitset
blackfire
brotli
bz2
calendar
cassandra*
cmark
csv
dba
ddtrace*
decimal
ds
ecma_intl*
enchant
ev
event
excimer
exif
ffi
ftp
gd
gearman &che

readme truncated — read the full docs on github

Frequently asked questions

Is dnmp free to use?

dnmp is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does dnmp do?

Docker LNMP (Nginx, PHP7/PHP5, MySQL, Redis)

What is dnmp written in?

dnmp is primarily written in Shell. Its source is publicly available at https://github.com/garylab/dnmp, and it has 4,089 GitHub stars.