khs1994 / lnmp

Start LNMP(LEMP) In less than 2 minutes Powered by Docker Compose. 使用 Docker Compose 一键搭建 LNMP(LEMP) 开发环境和生产环境(集群)!LNMP(LEMP) CaaS 解决方案

Home Page:https://lnmp.khs1994.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LNMP Docker

GitHub stars Build Status GitHub (pre-)release license Build Status

Start LNMP In Less than 2 minutes Powered By Docker Compose.

More Than LNMP Docker,Support ALL Arch、ALL Environment.

LNMP Docker is supported on Linux, macOS, Windows 10 on x86_64, and Debian (Raspberry Pi3) on arm.

Warning Don't Edit Any Files except .envWhy ?

Try k8s ?

Please see https://github.com/khs1994-docker/lnmp-k8s

Need PHP Under 7.1?

Please see https://github.com/khs1994-docker/lnmp/issues/354

Meet issues With MySQL 8.0 ?

Please see khs1994-docker#450

Prerequisites

To use LNMP Docker, you need:

Quick Start

Windows 10

Please see Windows 10.

Try WSL ?

Please see https://github.com/khs1994-docker/lnmp/tree/master/wsl

Install

Pick one method install LNMP Docker.

  • Using git clone

    $ git clone --recursive https://github.com/khs1994-docker/lnmp.git
    
    # $ git clone --recursive git@github.com:khs1994-docker/lnmp.git
    
    # **镜像
    
    $ git clone --recursive https://code.aliyun.com/khs1994-docker/lnmp.git
    
    # $ git clone --recursive git@code.aliyun.com:khs1994-docker/lnmp.git
  • Using Composer create project

    $ composer create-project --prefer-dist khs1994/lnmp ~/lnmp @dev
  • Using dpkg in Debian

    $ wget https://github.com/khs1994-docker/lnmp/releases/download/v18.05/khs1994-docker-lnmp_18.05_amd64.deb
    
    $ sudo dpkg -i khs1994-docker-lnmp*.deb
  • Using rpm in RHEL

    $ wget https://github.com/khs1994-docker/lnmp/releases/download/v18.05/khs1994-docker-lnmp-18.05-1.el7.centos.x86_64.rpm
    
    $ sudo yum install khs1994-docker-lnmp*.rpm [-y]
  • Using the convenience script

    $ curl -fsSL lnmp.khs1994.com -o lnmp.sh ; sh lnmp.sh

Start LNMP Demo

$ cd lnmp

$ ./lnmp-docker.sh up

$ curl 127.0.0.1

Welcome use khs1994-docker/lnmp v18.07 x86_64 With Pull Docker Image

development

MySQL default root password mytest

Start PHP Project

Start PHP project(e.g, Laravel) in ./app/ folder, And edit nginx config file in ./config/nginx/yourfilename.conf.

# $ ./lnmp-docker.sh new

$ ./lnmp-docker.sh restart nginx

How to connect Services

$redis->connect('127.0.0.1',6379);

$pdo = new \PDO('mysql:host=127.0.0.1;dbname=test;port=3306','root','mytest');

$redis = new \Redis();

$redis->connect('redis', 6379);

$pdo = new \PDO('mysql:host=mysql,dbname=test,port=3306', 'root', 'mytest');

Docker PHP Best Practice

PHPer commands

  • lnmp-php

  • lnmp-composer

  • lnmp-phpunit

  • lnmp-laravel

  • ...

For more information please see Documents

Issue SSL certificate

Powered by acme.sh

$ ./lnmp-docker.sh ssl www.khs1994.com

Please set API key and id in .env file or System ENV. Support Self-Signed SSL certificate, for more information, see Documents.

List LNMP Container

$ docker container ls -a -f label=com.khs1994.lnmp

Use Self-Build Docker Image

Edit Dockerfile in ./dockerfile/*/Dockerfile, then exec ./lnmp-docker.sh build.

Restart

# Restart all container
$ ./lnmp-docker.sh restart

$ ./lnmp-docker.sh restart nginx php7

Stop

$ ./lnmp-docker.sh stop

Stop and remove

$ ./lnmp-docker.sh down

Changelog

Updates every month, Version name is YY.MM. For more release information about LNMP Docker Version, see Releases.

Overview

Features

Please see Documents.

What's inside

Name Docker Image Version Based
ACME.sh khs1994/acme:2.7.8 2.7.8 Alpine:3.7
NGINX khs1994/nginx:1.15.0-alpine 1.15.0 Alpine:3.7
HTTPD httpd:2.4.33-alpine 2.4.33 Alpine:3.7
MySQL mysql:8.0.11 8.0.11 Debian:stretch
MariaDB mariadb:10.3.7 10.3.7 Debian:jessie
Redis redis:4.0.9-alpine 4.0.9 Alpine:3.7
PHP-FPM khs1994/php-fpm:7.2.6-alpine3.7 7.2.6 Alpine:3.7
Laravel khs1994/php-fpm:7.2.6-alpine3.7 5.6.x Alpine:3.7
Composer khs1994/php-fpm:7.2.6-alpine3.7 1.6.5 Alpine:3.7
PHP-CS-Fixer khs1994/php-fpm:7.2.6-alpine3.7 2.12.0 Alpine:3.7
Memcached memcached:1.5.8-alpine 1.5.8 Alpine:3.7
RabbitMQ rabbitmq:3.7.5-management-alpine 3.7.5 Alpine:3.7
PostgreSQL postgres:10.4-alpine 10.4 Alpine:3.7
MongoDB mongo:3.7.9 3.7.9 Debian:jessie
PHPMyAdmin phpmyadmin/phpmyadmin:latest latest Alpine:3.7
Registry registry:latest latest Alpine:3.4

Folder Structure

Folder description
app PHP project (HTML, PHP, etc)
backup backup database file
bin PHPer Commands
config configuration file
dockerfile Dockerfile
logs logs file
scripts bash shell script

Exposed Ports

  • 80
  • 443
  • 8080 PHPMyAdmin (Development only)

CLI

Easy to generate nginx or apache config, etc. Please use ./lnmp-docker.sh.

Run in Production

Start Containers as a Service(CaaS). For more information, see Documents.

LinuxKit

# OS: macOS

$ cd toolkit/linuxkit

$ linuxkit build lnmp.yml

$ linuxkit run -publish 8080:80/tcp lnmp

Open your Browers 127.0.0.1:8080

Who use in Production?

TLS1.3

Please see khs1994-docker#137

CI/CD

Please see khs1994-docker/ci

Docker Daemon TLS

Please see khs1994-docker/dockerd-tls

Documents

https://doc.lnmp.khs1994.com

Contributing

Please see Contributing

Thanks

More Information

Donate

Please see https://zan.khs1994.com

About

Start LNMP(LEMP) In less than 2 minutes Powered by Docker Compose. 使用 Docker Compose 一键搭建 LNMP(LEMP) 开发环境和生产环境(集群)!LNMP(LEMP) CaaS 解决方案

https://lnmp.khs1994.com

License:Apache License 2.0


Languages

Language:Shell 81.0%Language:PowerShell 15.2%Language:Python 2.8%Language:HTML 1.0%