{"id":14956807,"url":"https://github.com/yanlongma/docker-lnmp","last_synced_at":"2025-06-28T23:32:44.141Z","repository":{"id":109049514,"uuid":"175966029","full_name":"yanlongma/docker-lnmp","owner":"yanlongma","description":"Deploying LNMP(Linux、Nginx、Mysql、PHP-FPM) using docker-compose.","archived":false,"fork":false,"pushed_at":"2023-03-18T14:24:27.000Z","size":162,"stargazers_count":92,"open_issues_count":2,"forks_count":29,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T04:51:13.234Z","etag":null,"topics":["docker","docker-compose","docker-lnmp","lnmp","mongo","mysql","php-fpm","redis"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/yanlongma.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-16T11:55:55.000Z","updated_at":"2024-04-29T10:54:25.000Z","dependencies_parsed_at":"2023-05-26T03:12:39.699Z","dependency_job_id":null,"html_url":"https://github.com/yanlongma/docker-lnmp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/yanlongma/docker-lnmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanlongma%2Fdocker-lnmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanlongma%2Fdocker-lnmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanlongma%2Fdocker-lnmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanlongma%2Fdocker-lnmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yanlongma","download_url":"https://codeload.github.com/yanlongma/docker-lnmp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanlongma%2Fdocker-lnmp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262513625,"owners_count":23322661,"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","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-lnmp","lnmp","mongo","mysql","php-fpm","redis"],"created_at":"2024-09-24T13:13:33.969Z","updated_at":"2025-06-28T23:32:44.122Z","avatar_url":"https://github.com/yanlongma.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 使用 Docker LNMP 部署 PHP 开发环境\n\n\n## 项目简介\n\nDocker LNMP 是基于 docker-compose 开发的运行在 Docker 上的 LNMP 开发环境，包含 PHP、MySQL、Redis 等镜像并支持多版本切换，满足您的学习、开发和测试需求。\n\n\n## 包含镜像\n\nDocker LNMP 包含以下镜像，每种镜像支持多个版本：\n\n- nginx \n- php-fpm (8.1 - 8.0 - 7.4 - 7.3 - 7.2 - 7.1 - 5.6)\n- mysql (8.0 - 5.7 - 5.6)\n- redis (7.0 - 6.0 - 5.0 - 4.0)\n- memcached (1.5.16 - 1.5 - 1)\n- mongo\n\n其中：\n\nphp-fpm 默认是 8.1 版本，如需使用其它版本，配置 `.env` 文件中 `PHP_VERSION` 即可；\n\nmysql 默认是 8.0 版本，如需使用其它版本，配置 `.env` 文件中 `MYSQL_VERSION` 即可；\n\n\n## 下载使用\n\nDocker LNMP 默认将同级目录映射到 php-fpm 容器的工作目录，在项目的同级目录下载 Docker LNMP：\n```\n$ git clone https://github.com/yanlongma/docker-lnmp.git\n```\n\n进入 docker-lnmp 目录，生成配置文件 `.env`\n```\n$ cd docker-lnmp\n$ cp env-example .env\n```\n\n如需映射到其它目录，配置 `.env` 文件中 `WEB_ROOT_PATH` 即可。\n\n\n## 启动服务\n\n在 docker-lnmp 目录，启动服务，命令如下：\n``` \n$ docker-compose up -d nginx\nCreating network \"docker-lnmp_default\" with the default driver\nCreating docker-lnmp_mysql_1   ... done\nCreating docker-lnmp_php-fpm_1 ... done\nCreating docker-lnmp_nginx_1   ... done\n```\n\nnginx 默认会启动 php-fpm 和 mysql 服务，如需启动其它服务请手动添加，可选服务有 mongo、redis、memcached。\n\n启动成功后，在 docker-lnmp 同级目录新建 phpinfo.php 文件，浏览器访问 `http://localhost/phpinfo.php`，则可看到 phpinfo() 相关信息。\n\n\n## 关闭服务\n\n在 docker-lnmp 目录，关闭服务，命令如下：\n``` \n$ docker-compose down\n```\n\n\n## 构建服务\n\n如修改 dockerfile 文件，需重新构建服务，如重新构建 php-fpm 命令如下：\n```\n$ docker-compose build php-fpm\n```\n\n建议先关闭服务，构建完成再重启服务。\n\n\n## 虚拟主机\n\nNginx 虚拟主机相关配置请参考如下文档，配置完需重启服务，完整配置请参考 `nignx/sites/laravel.conf` 文件：\n- [Nginx 配置虚拟主机](./docs/vhost.md)\n- [Nginx 配置 HTTPS](./docs/https.md)\n\n\n## License\n\n[MIT license](https://opensource.org/licenses/MIT)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanlongma%2Fdocker-lnmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanlongma%2Fdocker-lnmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanlongma%2Fdocker-lnmp/lists"}