https://hub.docker.com/_/nginx?tab=tags
version: '3.8'
services:
nginx:
image: nginx:stable
restart: always
#network_mode: host
container_name: nginx_1021
volumes:
- ./conf.d:/etc/nginx/conf.d
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html:/usr/share/nginx/html
- ./logs:/var/log/nginx
- ./data:/data
ports:
- "80:80"
environment:
- NGINX_HOST=dk.local.lren.org
# - NGINX_PORT=80
depends_on:
- "php"
networks:
- my_net
php:
#构建自定义镜像
build:
context: ./
dockerfile: Dockerfile-php
image: php:7.3.31-fpm
container_name: php_1021
restart: always
#ports:
# - "9000:9000"
expose:
- 9000
volumes:
- ./data:/data
networks:
- my_net
networks:
my_net:
driver: bridge
version: '3.8'
services:
nginx:
image: nginx:stable
restart: always
#network_mode: host
container_name: ngx_1024
volumes:
- ./conf.d:/etc/nginx/conf.d
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html:/usr/share/nginx/html
- ./logs:/var/log/nginx
- /data/khh:/data/khh
ports:
- 80:80
# - 8001:8001
environment:
- TZ='Asia/Shanghai'
#- NGINX_HOST=tch.h5.kh.mj.aijxb.com
- NGINX_PORT=80
php:9000 #修改为php容器(compose文件中nginx段设置的links的php名称)