This is a Dokcer-based LNMPA (Nginx + PHP + Apache + MySQL) environment, compiled and managed with Docker compose, which can be used for local development and online deployment.
Due to the limitation of Docker, it is recommended to use CentOS7+, Ubuntu16.04 Server+ for the server system. For the installation and setting of Dokcer, see https://github.com/whorusq/docker-learning
1. Directory structure
.
├── README.md
├── build <---------- 各服务 Dockerfile 文件
│ ├── mysql
│ │ └── Dockerfile
│ ├── nginx
│ │ └── Dockerfile
│ └── php_apache
│ ├── Dockerfile
│ └── source.list <---------- 阿里云软件更新源
├── conf
│ ├── apache
│ │ ├── apache2.conf <---------- Apache 服务配置
│ │ ├── ports.conf <---------- 监听端口配置
│ │ ├── sites-available <---------- Apache 站点配置目录
│ │ │ └── www.conf
│ │ └── sites-enabled <---------- 映射站点配置
│ │ ├── README.md
│ │ └── www.conf -> ../sites-available/www.conf
│ ├── mysql <---------- MySQL 自定义配置目录
│ │ └── mysql.env
│ ├── nginx
│ │ ├── nginx.conf <---------- Nginx 服务配置
│ │ └── vhosts <---------- Nginx 站点配置目录
│ │ ├── README.md
│ │ └── www.conf
│ └── php <---------- PHP 自定义配置目录
│ └── php.ini
├── data <---------- MySQL 数据文件目录,初始化启动后自动生成
├── docker-compose.yml <---------- ❗️❗️❗️Docker compose 配置文件,可根据需要修改软件版本、映射目录等
├── log <---------- 日志文件目录,当产生日志时自动生成
└── www -> /Users/user1/www <---------- 映射本地 www 根目录
2. Use
-
Clone or download the source code
➜ git clone https://github.com/whorusq/docker-lnmpa.git lnmpa
-
Replace www directory
➜ cd lnmpa ➜ mv www www_bak ➜ ln -s /home/user1/www www
-
Initialize startup
# 此过程将初始化 php_apache、mysql、nginx,并前台启动服务 ➜ docker-compose up
If there is an error in the whole process, the initialization will be terminated, and the error message can be adjusted.
After normal startup, the directory will generate
- ./data MySQL data file
- ./log all log files
# 后台启动 ➜ docker-compose up -d # 停止服务 ➜ docker-compose stop
Continuous updates: https://github.com/whorusq/docker-lnmpa