docker:nginx:docker_compose
Table of Contents
Docker - Nginx - Docker Compose
networks: webserver: driver: bridge ipam: config: - subnet: 172.20.0.0/24 webserver: image: nginx:latest container_name: webserver networks: - webserver ports: - 7080:80 - 7443:443 restart: always volumes: - $DOCKERDIR/nginx/html:/var/www/html - $DOCKERDIR/nginx/conf/:/etc/nginx/conf.d/:ro
Docker Compose - lscr.io
--- services: nginx: image: lscr.io/linuxserver/nginx:latest container_name: nginx environment: - PUID=1000 - PGID=1000 - TZ=Etc/UTC - NGINX_AUTORELOAD= #optional - NGINX_AUTORELOAD_WATCHLIST= #optional volumes: - /path/to/nginx/config:/config ports: - 80:80 - 443:443 restart: unless-stopped
Link with PHP
version: '3' services: web: image: nginx:latest ports: - "8080:80" volumes: - ./src:/usr/share/nginx/html links: - php php: image: php:7-fpm
NOTE:
- php – It will download php-fpm image, create a container and link it with the Nginx container.
References
docker/nginx/docker_compose.txt · Last modified: 2025/07/21 08:27 by peter