{"id":23462012,"url":"https://github.com/cslant/lemp-docker","last_synced_at":"2025-08-26T19:30:39.334Z","repository":{"id":37589033,"uuid":"477789371","full_name":"cslant/lemp-docker","owner":"cslant","description":":whale: This is a simple Docker Compose workflow that sets up a LEMP network of containers for local development. This also allows customizing the optional PHP version :elephant:","archived":true,"fork":false,"pushed_at":"2024-07-31T18:04:10.000Z","size":206,"stargazers_count":11,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T20:41:19.476Z","etag":null,"topics":["docker","docker-compose","docker-image","docker-lemp","docker-lemp-phpmyadmin","docker-nginx","docker-nginx-php","docker-ssl","docker-templates","laravel","laravel-docker","lbiltech","lemp","lemp-deployer","lemp-docker","lemp-environment","lemp-stack","multi-docker","nginx","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cslant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-04T16:45:31.000Z","updated_at":"2025-02-22T12:50:11.000Z","dependencies_parsed_at":"2022-07-18T08:13:39.010Z","dependency_job_id":null,"html_url":"https://github.com/cslant/lemp-docker","commit_stats":null,"previous_names":["cslant/lemp-docker"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/cslant/lemp-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flemp-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flemp-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flemp-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flemp-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cslant","download_url":"https://codeload.github.com/cslant/lemp-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cslant%2Flemp-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272249229,"owners_count":24899955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","docker-image","docker-lemp","docker-lemp-phpmyadmin","docker-nginx","docker-nginx-php","docker-ssl","docker-templates","laravel","laravel-docker","lbiltech","lemp","lemp-deployer","lemp-docker","lemp-environment","lemp-stack","multi-docker","nginx","php"],"created_at":"2024-12-24T08:15:28.044Z","updated_at":"2025-08-26T19:30:38.995Z","avatar_url":"https://github.com/cslant.png","language":"PHP","readme":"# Welcome to Docker Config for LEMP Network\n\n:whale: This is a simple Docker Compose workflow that sets up a LEMP network with PHP, Nginx, MariaDB, etc.\n\nThis configuration can be used for any PHP project (Laravel, Yii, CodeIgniter, Pure PHP, etc.) :tada:\n\n[![Docker](https://github.com/lbiltech/lemp-docker/actions/workflows/docker-publish.yml/badge.svg)](https://hub.docker.com/r/lbiltech/lemp)\n\n## Table of Contents\n\n - [Configuration requirements](#configuration-requirements)\n - [Add your custom bash script to run docker](#add-your-custom-bash-script-to-run-docker)\n - [Installation and Setup](#installation-and-setup)\n - [Check the network ID and connect Database](#check-the-network-id-and-connect-database)\n\n\n\u003e Other docker configs: [LAMP Stack (Apache, PHP, MariaDB, Redis)](https://github.com/tanhongit/lamp-docker.git) :whale:\n\n## Configuration requirements\n\nTo use the fpm image, you need an additional web server, such as Nginx, that can proxy HTTP-request to the fpm-port of the container. For fpm connection, this container exposes port 9000.\n\n- **Multi-site integration**\n- **PHP optional version with custom in .env file** (example: 7.4, 8.0, 8.1, 8.2, etc.)\n- Web-server: **Nginx**\n- DBMS (database management system): **Mariadb**\n- In-memory database: **Redis**\n- SSL Certificate (using **mkcert**)\n\n## Add your custom bash script to run the docker\n\n\u003e **Because maybe my configuration is not enough for the configuration required by your project or purpose, you need to add more configuration to the docker.**\n\nWith nature of allowing you to customize the PHP version according to your. We should also allow custom bash scripts to run when starting the docker.\n\nSo, you can add your custom bash script to run docker in the file **_docker/bash/custom.sh_** with the following steps:\n\n### 1. Create a file **_docker/bash/custom.sh_**:\n\nRun:\n\n```bash\ncd docker/bash\ncp custom.sh.example custom.sh\n```\n\n### 2. Add your custom bash script to run the docker\n\nThen, you can add your custom bash script to run docker in the file **_docker/bash/custom.sh_**.\n\nFor example, you want to install **_ngrok_** extension for your docker container:\n\n```bash\n#!/bin/bash\n\n# Install ngrok\nsnap install ngrok\n\n# Install ngrok for php\ndocker-php-ext-install ngrok\n\n# You can install other extensions here\n# docker-php-ext-install \u003cextension_name\u003e\n\n# etc.\nnpm install -g localtunnel\n```\n\nAnd now, just follow the steps below and run the docker.\n\n## Installation and Setup\n\n\u003e **Warning**: If you don't want to use SSL, you can skip steps 1 and 2 and edit conf files in _**docker/config/conf.d/*.conf**_ to remove the SSL configuration.\n\nPlease remove the 443 port in _**docker/config/conf.d/*.conf**_ file and use 80 port for HTTP:\n\n```nginx\nserver {\n    listen 80;\n    server_name laravel-demo-site.com;\n    root /var/www/laravel-demo/public;\n    index index.php index.html index.htm;\n\n    access_log /var/log/nginx/laravel-demo.access.log;\n    error_log /var/log/nginx/laravel-demo.error.log;\n\n    location / {\n        try_files $uri $uri/ /index.php?$query_string;\n    }\n\n    location ~ \\.php$ {\n        try_files $uri =404;\n        fastcgi_pass php:9000;\n        fastcgi_index index.php;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        include fastcgi_params;\n    }\n}\n```\n\nIf you want to use SSL, please ignore the above warning and follow all the steps below.\n\n### 1. Install SSL certificate\n\nUsing mkcert to create ssl certificate\n\n#### For Ubuntu\n\n```shell\nsudo apt install libnss3-tools\n\nsudo wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 \u0026\u0026 \\\nsudo mv mkcert-v1.4.3-linux-amd64 mkcert \u0026\u0026 \\\nsudo chmod +x mkcert \u0026\u0026 \\\nsudo cp mkcert /usr/local/bin/\n```\n\n#### For Mac or Windows\n\nPlease check and install mkcert at: https://github.com/FiloSottile/mkcert\n\nNow that the mkcert utility is installed, run the command below to generate and install your local CA:\n\n```shell\nmkcert -install\n```\n\n### 2. Create an SSL certificate for this project\n\nRun:\n\n```shell\ncd docker/server/certs\nmkcert demo-site.local\nmkcert laravel-demo-site.com\n```\n\n### 3. Run to start the docker\n\n```shell\ndocker-compose up -d\n```\n\n### 4. Modify **.env** on the Laravel source\n\n```dotenv\nPHP_VERSION_SELECTED=8.2 # Choose the PHP version for your project\n\nAPP_NAME=lemp-stack # name of your docker project\nAPP_PORT=91 # port for docker server (apache)\nSSL_PORT=448 # port for docker server (apache) with SSL\nDB_PORT=13393 # port for the database (MariaDB)\n\nMYSQL_ROOT_PASS=root\nMYSQL_USER=root\nMYSQL_PASS=root\nMYSQL_DB=default-db # name of your database\n\nPHPMYADMIN_PORT=9018 # port for phpmyadmin (database admin)\nPHPMYADMIN_UPLOAD_LIMIT=1024M # set upload limit for phpmyadmin\nIP_DB_SERVER=127.0.0.1\n\nREDIS_PORT=16379 # port for Redis (in-memory database)\n```\n\n## Check the network ID and connect the Database\n\n### 1. Check CONTAINER ID\n- Run `docker ps` to check the Container ID of **APP_NAME-db**\n- Run the command `docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \u003ccontainer ID\u003e`\n\n```shell\ndocker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \u003ccontainer_ID\u003e\n```\n\n![image](https://user-images.githubusercontent.com/35853002/232272286-4dd7cc26-1257-4b1e-9605-7d6ecfd69a37.png)\n\n\n### 2. Connect to Database\n\nUse the IP address to connect to the database using the database management system (DBMS) of your choice. For example, using MySQL Workbench:\n\n![image](https://user-images.githubusercontent.com/35853002/232210044-7dd5aafa-352f-45d8-ba99-82cb792b1066.png)\n\nYou can also connect to the database using the DB_PORT in the .env file\n\nFor example, using MySQL Workbench: DB_PORT=13398\n\n![image](https://user-images.githubusercontent.com/35853002/232210171-af56d440-c9f0-4477-a1a7-338b86995cd7.png)\n\n## This is the demo of the result:\n![image](https://user-images.githubusercontent.com/35853002/183320614-fa670785-9aa7-411a-a1ff-15e349cee58d.png)\n\n## Add database for the second project (When using multiple sites)\n\nWhat was instructed above can only be applied and created a database for **default-db**\n\nFor __laravel-demo-site.com__ to work, you need to create a new database for it.\n\nPlease add a new database for laravel-demo-site.com with the __phpmyadmin__ tool or any other tool you like. And then, please update __DB_HOST__ on __.env__ file to the new database of __laravel-demo__ source.\n\nExample: This configuration in **laravel-demo** source\n\n```dotenv\nDB_CONNECTION=mysql\nDB_HOST=172.21.0.3 # IP address of APP_NAME-db\nDB_PORT=3306\nDB_DATABASE=laravel_demo # name of the database\nDB_USERNAME=root\nDB_PASSWORD=root\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Flemp-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcslant%2Flemp-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcslant%2Flemp-docker/lists"}