Home

Awesome

LNMP Docker

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

star

:computer: :whale: :elephant: :dolphin: :penguin: :rocket: Start LNMP In Less than 2 minutes Powered By Docker Compose, one command $ ./lnmp-docker up

PlatformStatus
WindowsBuild status
LinuxBuild Status
macOSCI
Linux arm64v8-
<p align="center"> <img width="600" src="https://user-images.githubusercontent.com/16733187/47264269-2467a780-d546-11e8-8cde-f63207ee28d9.jpg"> </p>

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 .env Why ?

:warning: Run Laravel on Docker For Windows very slow. solve it.

:gift: Donate

WeChat

<p align="center"> <img width="200" src="https://user-images.githubusercontent.com/16733187/46847944-84a96b80-ce19-11e8-9f0c-ec84b2ac463e.jpg"> </p> <p align="center"><strong>Welcome developer subscribe WeChat</strong></p>

Prerequisites

To use LNMP Docker, you need:

:one: Git

:two: Docker 23.11 Stable +

:three: Docker Compose v2.17.0+

:four: WSL (Windows Only)

Quick Start

Windows 10

Please see Windows 10.

Install

Use git install LNMP Docker.

$ git clone --depth=1 https://github.com/khs1994-docker/lnmp.git

# $ git clone --depth=1 git@github.com:khs1994-docker/lnmp.git

# 中国镜像

$ git clone --depth=1 https://gitee.com/khs1994-docker/lnmp.git

# $ git clone --depth=1 git@gitee.com:khs1994-docker/lnmp.git

Start LNMP Demo

$ cd lnmp

$ ./lnmp-docker up

$ curl 127.0.0.1

Welcome use khs1994-docker/lnmp v23.11 x86_64 With Pull Docker Image

development

:bulb: MySQL default root password mytest

Start PHP Project

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

# $ ./lnmp-docker new

$ ./lnmp-docker restart nginx

You can set APP_ROOT to change PHP project folder.

More information please see Docker PHP Best Practice https://github.com/khs1994-docker/php-demo

How to connect Services

$redis = new \Redis();

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

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

Advanced

PHPer commands

For more information please see Documents

Issue SSL certificate

Powered by acme.sh

$ ./lnmp-docker ssl khs1994.com -d *.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 build.

Restart

# Restart all container
$ ./lnmp-docker restart

$ ./lnmp-docker restart nginx php8

Stop

$ ./lnmp-docker stop

Stop and remove

$ ./lnmp-docker down

Overview

Features

Please see Documents.

What's inside

NameDocker ImageVersionBased
ACME.shkhs1994/acme:3.0.03.0.0alpine:3.16
NGINXnginx:1.25.3-alpine1.25.3alpine:3.13
NGINX Unitkhs1994/php:8.3.0-unit-alpine1.30.0alpine:3.16
HTTPDhttpd:2.4.53-alpine2.4.53alpine:3.16
MySQLmysql:8.0.338.0.33oraclelinux:8-slim
MariaDBmariadb:10.11.510.11.5ubuntu:jammy
Redisredis:7.0.0-alpine7.0.0alpine:3.16
PHP-FPMkhs1994/php:8.3.0-fpm-alpine8.3.0alpine:3.19
Composerkhs1994/php:8.3.0-composer-alpine2.5.8alpine:3.19
Memcachedmemcached:1.6.15-alpine1.6.15alpine:3.16
RabbitMQrabbitmq:3.9.0-management-alpine3.9.0alpine:3.13
PostgreSQLpostgres:14.0-alpine14.0alpine:3.14
MongoDBmongo:5.0.35.0.3ubuntu:bionic
PHPMyAdminphpmyadmin:5.2.05.2.0alpine:3.16
Registryregistry:latestlatestalpine:3.11

Folder Structure

Folderdescription
appPHP project (HTML, PHP, etc)
scripts/backupbackup database file
binPHPer Commands
configconfiguration file
dockerfileDockerfile
loglog file
scriptsbash shell script

Exposed Ports

CLI

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

Who use in Production?

khs1994.com

PCIT -- PHP CI TOOLKIT

HTTP3/QUIC

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

CI/CD

Please see khs1994-docker/ci

Documents

https://docs.lnmp.khs1994.com

Contributing

Please see Contributing

Thanks

More Information

Donate

Please see https://zan.khs1994.com