“Docker lnmp Docker-compose搭建nginx+php+mysql”的版本间的差异
(→参考) |
(→参考) |
||
(未显示同一用户的3个中间版本) | |||
第1行: | 第1行: | ||
==[http://wiki.linuxchina.net/index.php?title=Docker-compose%E6%95%99%E7%A8%8B#install Docker-Compose install]== | ==[http://wiki.linuxchina.net/index.php?title=Docker-compose%E6%95%99%E7%A8%8B#install Docker-Compose install]== | ||
+ | https://wiki.linuxchina.net/index.php/Alpine#alpine_docker_php 站内参考 | ||
[[Docker nginx]] | [[Docker nginx]] | ||
第269行: | 第270行: | ||
[https://www.jianshu.com/p/3384e342502b 使用Docker快速搭建Nginx+PHP-FPM环境] | [https://www.jianshu.com/p/3384e342502b 使用Docker快速搭建Nginx+PHP-FPM环境] | ||
=参考= | =参考= | ||
+ | |||
+ | [https://blog.csdn.net/q6627666/article/details/89256238 Docke搭建Nginx+php-fpm+https] | ||
+ | |||
+ | [https://www.cnblogs.com/xiao987334176/p/12918413.html 使用Docker快速搭建Nginx+PHP-FPM+MySQL+phpMyAdmin环境] | ||
+ | |||
[https://blog.csdn.net/xiazichenxi/article/details/95652457 docker-compose一键部署LNMP环境(Nginx+MySQL+PHP)] | [https://blog.csdn.net/xiazichenxi/article/details/95652457 docker-compose一键部署LNMP环境(Nginx+MySQL+PHP)] | ||
第297行: | 第303行: | ||
[https://blog.rj-bai.com/post/138.html docker 奔跑 LNMP 运行环境] | [https://blog.rj-bai.com/post/138.html docker 奔跑 LNMP 运行环境] | ||
− | + | [https://learnku.com/articles/31344?tdsourcetag=s_pcqq_aiomsg 避坑!用 Docker 搞定 PHP 开发环境搭建(Mac、Docker、Nginx、PHP-FPM、XDebug、PHPStorm、VSCode) ] | |
[[category:Container]] [[category:compose]] [[category:ops]] | [[category:Container]] [[category:compose]] [[category:ops]] |
2021年8月26日 (四) 06:23的最新版本
目录
Docker-Compose install
https://wiki.linuxchina.net/index.php/Alpine#alpine_docker_php 站内参考
How to Create a MySql Instance with Docker Compose
php
mkdir docker4php && cd docker4php vi Dockerfile FROM php:7.1-fpm-stretch #原来是这个 但是这个就不能apt 如果要和下面对应 要改一下 #FROM php:7.1-fpm-alpine Run apt-get update \ && apt install iputils-ping \ && docker-php-ext-install mysqli && docker-php-ext-enable mysqli
compose
mkdir npm4compose cd npm4compose mkdir conf.d php html cd conf.d && touch nginx.conf cd - cd html && touch index.php && echo "<?php phpinfo(); ?>" >index.php cd .. mv ~/docker4php/Dockerfile ./php/ [root@localhost npm4compose]# tree . |-- conf.d | `-- nginx.conf |-- docker-compose.yml |-- html | `-- index.php `-- php `-- Dockerfile vi docker-compose.yml version: '3' services: nginx: image: nginx:latest ports: - "80:80" depends_on: - "php" volumes: - "${PWD}/conf.d:/etc/nginx/conf.d" - "${PWD}/html:/usr/share/nginx/html" networks: - d_net container_name: "compose-nginx" php: build: ./php #指定build Dockerfile生成镜像 image: php:7.1-fpm-alpine ports: - "9000:9000" volumes: - "$PWD/html:/var/www/html" networks: - d_net container_name: "compose-php" mysql: image: mysql:5.7 ports: - "3306:3306" environment: MYSQL_DATABASE: 'db' # So you don't have to use root, but you can if you like MYSQL_USER: 'evan' # You can use whatever password you like MYSQL_PASSWORD: '123456' # Password for root access MYSQL_ROOT_PASSWORD: '123456' expose: # Opens port 3306 on the container - '3306' networks: - d_net container_name: "compose-mysql" networks: d_net: driver: bridge vi conf.d/nginx.conf server{ listen 80; server_name a.com; #server_name localhost; location /{ root /var/www/html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; } location ~ \.php$ { include fastcgi_params; fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; } } docker-compose up -d
php连接mysql
测试检查
[root@work2 npm4compose]# docker-compose ps Name Command State Ports ----------------------------------------------------------------------------------------- compose-mysql docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp, 33060/tcp compose-nginx nginx -g daemon off; Up 0.0.0.0:80->80/tcp compose-php docker-php-entrypoint php-fpm Up 0.0.0.0:9000->9000/tcp docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0e2e7b200b47 nginx:latest "nginx -g 'daemon of…" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp compose-nginx b0990f13ddd2 mysql:5.7 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp compose-mysql e0ff739663a9 php:7.1-fpm-alpine "docker-php-entrypoi…" 5 minutes ago Up 5 minutes 0.0.0.0:9000->9000/tcp compose-php http://192.168.88.22/index.php dns cat /etc/hosts 192.168.88.22 a.com
mysql暂时不用这个
docker pull mysql:8.0
How to Create a MySql Instance with Docker Compose
trouble
docker-compose up -d ERROR: The Compose file './docker-compose.yml' is invalid because: services.php.networks contains {"d_net": null}, which is an invalid type, it should be a string networks: - d_net : :不能要 [root@localhost npm4compose]# cat php/Dockerfile FROM php:7.1-fpm-alpine Run apt-get update \ && apt install iputils-ping \ && docker-php-ext-install mysqli && docker-php-ext-enable mysqli 这个alpine 他居然安装软件是apt 我去 这么搞笑 nginx: image: nginx:lastest ports: 这些单词 拼写 我去 , 定义网络叫app_net 写在应用又写了d_net container_name: "compose-php" mysql: image: mysql:8.0 ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD={your_passwd} networks: - d_net container_name: "compose-mysql" networks: #配置docker 网络 app_net: driver: bridge
2020年 11月 15日 星期日 13:34:00 CST给phper
https://github.com/evan886/docker-compose-lnmp
有空要结合我上面的 再搞好一些
避坑!用 Docker 搞定 PHP 开发环境搭建(Mac、Docker、Nginx、PHP-FPM、XDebug、PHPStorm、VSCode)
https://github.com/yansongda/docker-compose-LNMP
【docker】 linux 下 使用docker搭建 lNMP
see also
基于Dockerfile构建LNMP(good-php扩展php7+mysql+nginx
docker-compose部署LNMP环境 Nginx(Openresty)、MySQL5.7、PHP7.2(5.6)、Redis5.0、PHPMyAdmin、Xdebug
Nginx 1.15.X Linux Debian/Ubuntu 源码编译安装 LNMP之Nginx
MySQL 5.6 Linux Debian/Ubuntu源码编译安装 LNMP之MySQL
在 Debian 上源码编译和安装 Nginx+PHP+FastCGI+MySQL
good_testmysql-docker-compose搭建nginx+php+mysql
从零开始学习Docker - 搭建 nginx+mysql+php 环境
使用Docker-Compose搭建nginx+php+mysql基础应用
https://github.com/kkmike999/docker-compose-php-nginx-mysql/blob/master/docker-compose.yml
compose install more PHP extensions
使用docker-composer创建一个mysql容器,并创建一个database且指定其编码集为中文utf8
Docker docker-compose 配置Nginx+Php+Mysql开发环境
docker-compose搭建 Nginx+PHP+MySQL 环境
从零开始学习Docker - 搭建 nginx+mysql+php 环境
docker-compose 部署 nginx + php-fpm + mysql + phpmyadmin
docker-compose php + nginx + mysql
参考
使用Docker快速搭建Nginx+PHP-FPM+MySQL+phpMyAdmin环境
docker-compose一键部署LNMP环境(Nginx+MySQL+PHP)
https://github.com/nanoninja/docker-nginx-php-mysql
Docker快速搭建一套PHP、Nginx、MySQL、Redis、Xdebug、Memcached 开发环境并演进
Docker多容器配合实现开发环境(nginx、php、memcached、mysql)
MySQL on Docker: Building the Container Image
避坑!用 Docker 搞定 PHP 开发环境搭建(Mac、Docker、Nginx、PHP-FPM、XDebug、PHPStorm、VSCode)