# docker-lnmp **Repository Path**: haima1004/docker-lnmp ## Basic Information - **Project Name**: docker-lnmp - **Description**: docker-lnmp - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-24 - **Last Updated**: 2024-02-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 支持环境 - mysql - nginx - redis - php - gitea ## 目录结构 ```sh . ├── docker-compose.yaml ├── mysql │ ├── conf │ │ ├── my.cnf │ │ └── mysqld.cnf │ ├── data │ └── log ├── nginx │ ├── conf.d │ │ ├── bjdasong.cn.conf │ │ ├── doc.haimait.conf │ │ ├── server.confbak │ │ └── test.haimait.com.conf │ ├── fastcgi_params │ ├── koi-utf │ ├── koi-win │ ├── logs │ │ ├── access.log │ │ ├── doc.haimait.access.log │ │ ├── doc.haimait.error.log │ │ └── error.log │ ├── mime.types │ ├── nginx.conf │ ├── scgi_params │ ├── uwsgi_params │ └── win-utf ├── php │ ├── Dockerfile │ ├── Dockerfile.bak │ ├── php.ini │ └── sources.list └── redis ├── conf │ └── redis.conf └── data ├── appendonly.aof └── dump.rdb ``` ## docker-compose.yaml 哪个容器不用,可以注释了 **注意**:(已经配置好,可根据自己的目录配置) 把go和php的代码目录映射到nginx容器里 php代码目录需要映射到php的容器里 ## 安装php扩展 如果安装扩展可以修改`/lnmp/php/Dockerfile`文件里的 在docker-php-ext-install 后面接着添加 注意:如果php打包不成功,可以直接从本人的阿里镜像仓库中拉取,下面是我打好的php镜像 docker pull registry.cn-beijing.aliyuncs.com/haimait/php:7.3.8-fpm-alpine-extend 阿里云镜像仓库使用参考下面的文档: https://www.cnblogs.com/haima/p/13549225.html ## 代码目录里 /www/wwwroot/ phpinfo.php ```php mtu 1500 inet 192.168.48.1 netmask 255.255.240.0 broadcast 192.168.63.255 inet6 fe80::42:80ff:fe8f:606e prefixlen 64 scopeid 0x20 ether 02:42:80:8f:60:6e txqueuelen 0 (Ethernet) RX packets 2769 bytes 983651 (960.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2206 bytes 2139074 (2.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 br-930829796f3a: flags=4099 mtu 1500 inet 172.27.0.1 netmask 255.255.0.0 broadcast 172.27.255.255 inet6 fe80::42:96ff:fe25:f216 prefixlen 64 scopeid 0x20 ether 02:42:96:25:f2:16 txqueuelen 0 (Ethernet) RX packets 2769 bytes 983651 (960.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2206 bytes 2139074 (2.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 br-e6b61e523280: flags=4163 mtu 1500 inet 172.22.0.1 netmask 255.255.0.0 broadcast 172.22.255.255 inet6 fe80::42:79ff:fe1f:d0a1 prefixlen 64 scopeid 0x20 ether 02:42:79:1f:d0:a1 txqueuelen 0 (Ethernet) RX packets 384 bytes 191666 (187.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 254 bytes 183125 (178.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` 得到 宿主机的ip为172.27.0.1 在php代码连接到这个ip即可 ### 使用composer **主机中使用composer命令** 启动: `docker-compose up -d` 重启: `docker-compose restart` 停用: `docker-compose stop` 启用: `docker-compose start` 停用并删除: `docker-compose down` ### gitea 安装配置参考文档: https://www.cnblogs.com/haima/p/16270143.html