Code Monkey home page Code Monkey logo

alpine-lnmp's Introduction

alpine-lnmp

The docker-compose.yml include PHP7、NGINX、MySql、Redis 一键安装 LNMP 环境

Build Images

Directory

/
├── data                                               数据挂载目录
│   ├──mysql                                          MySql挂载目录
│   │   ├── conf                                     配置文件目录
│   │   │   ├── my.cnf                              配置文件,在 Dockerfile 中指定,可修改配置后执行
│   │   ├── data                                     数据目录
│   │   ├── logs                                     日志目录
│   │   │   ├── error.log                           错误日志,可以在 my.cnf 中配置
│   │   │   ├── slow_query.log                      慢查询日志,可以在 my.cnf 中配置
│   │ 
│   ├── nginx                                         Nginx挂载目录
│   │   ├── cert                                     HTTPS证书文件目录
│   │   ├── conf                                     配置文件目录
│   │   │   ├── nginx.conf                          配置文件,在 Dockerfile 中指定,可修改配置后执行
│   │   │   ├── vhost                               虚拟主机配置文件
│   │   │   │    ├── www.site-https.com.conf       虚拟主机配置示例
│   │   │   │    ├── www.site-test.com.conf        虚拟主机配置示例
│   │   ├── logs                                     日志目录
│   │   │   ├── access.log                          日志文件,可以在 nginx.conf 中配置
│   │   │   ├── error.log                           日志文件,可以在 nginx.conf 中配置
│   │ 
│   ├── php                                           PHP挂载目录
│   │   ├── conf                                     配置文件目录
│   │   │   ├── php.ini                             配置文件,在 Dockerfile 中指定,可修改配置后执行
│   │   │   ├── php-fpm.conf                        配置文件,可修改配置后执行
│   │   │   ├── www.conf                            配置文件,可修改配置后执行
│   │   ├── logs                                     日志目录
│   │   │   ├── error.log                           日志文件,可以在 php-fpm.conf 中配置
│   │   
│   ├── redis                                         REDIS挂载目录
│   │   ├── conf                                     配置文件目录
│   │   │   ├── redis.conf                          配置文件,在 Dockerfile 中指定,密码在此修改,可修改配置后执行
│   │   ├── data                                     数据目录
│   │   ├── logs                                     日志目录
│   │   │   ├── redis.log                           日志文件,可以在 redis.conf 中配置
│   │   
│   ├── www                                           代码存放目录
│
├── docker-compose.yml                                 docker-compose 文件

Custom

- 自定义端口
- 自定义数据库密码
- 自定义redis密码
- 自定义挂载目录,确保挂载目录有相应的文件

Require

- `git`
- `docker`
- `docker-compose`

Use

- `git clone [email protected]:wangyongdong/alpine-lnmp.git` 克隆项目
- `cd alpine-lnmp`
- `docker-compose up -d` RUN

Composer

PHP 容器已经安装 Composer,使用时进入到容器内部执行

`docker exec -it php /bin/sh`

然后进入对应目录执行:`composer update`

HTTPS

  - 1. 将证书文件分别命名为 `nginx_ssl.pem`,`nginx_ssl.key`,存放在 `data/nginx/cert` 目录下
  - 2. 修改 `nginx.conf` 或 虚拟主机配置文件 `vhost/www.xxx.conf`,示例查于 `www.site-https.com.conf`
  - 3. 修改 `www.site-https.com.conf` 去掉 `default_server` ,不去掉的话会报错
  - 4. `docker-compose up -d`
  - 5. 输入 `https://xxx` 测试

Test

- 127.0.0.1     访问链测试
- 127.0.0.1/mysql.php 测试mysql,默认使用容器名连接,可以修改连接ip地址
- 127.0.0.1/redis.php 测试redis,默认使用容器名连接,可以修改连接ip地址,redis密码在配置文件中修改

DEBUG

- `docker-compose ps` 查看运行容器
- `docker-compose stop` 停止容器
- `docker-compose rm` 删除容器
- `docker inspect xxx` 查看运行容器ip

alpine-lnmp's People

Contributors

wangyongdong avatar yuejie89 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.