Clone this repo
git clone https://github.com/patipark/docker-nginx-phpfpm.git
or clone via ssl
git clone [email protected]:patipark/docker-nginx-phpfpm.git
change working directory
cd docker-nginx-phpfpm
Your can put you PHP/web content into "src" directory.
docker-nginx-phpfpm ‹main*›$ tree
.
├── default.conf
├── docker-compose.yml
├── README.md
└── src #<<< put php file or you web content under here
├── index.php
└── sqlsrv.php
You can ajust docker-compose.yml file depend on your environment.such as port , php version
version: "3.9"
services:
web:
restart: always
image: nginx:latest
ports:
- "8080:80" #<<< change your port here etc .. 8088:80
volumes:
- ./src:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm
php-fpm:
restart: always
# php image url : https://hub.docker.com/repository/docker/patipark/php-fpm/general
image: patipark/php-fpm:7.4-sqlsrv
volumes:
- ./src:/var/www/html
Run docker-compose command to start all services stack.
docker-compose up -d
After start dokcer service ,open your browser with url http://localhost:8080 or http://host-ip-address:port (your defined port)
Run docker-compose command to shutdown all services stack.
docker-compose down
edit .env file and change COMPOSE_PROJECT_NAME=your project name
# .env
# https://docs.docker.com/compose/reference/envvars/#compose_project_name
# Explicitly set volume's prefix or use -P with a docker run command.
COMPOSE_PROJECT_NAME=nginx-phpfpm
Run docker command to list all service runing.
docker ps
Run docker command to list all network runing.
docker network ls
Run docker command to list all volumes runing.
docker volume ls