start
Pull configuration
git clone https://github.com/flxxyz/fast-deploy-website.git && cd fast-deploy-website
Start instance
docker-compose up -d
Add site
-
Add the following code block to docker-compose.yml
Site name:
container_ Name: site name
restart: always
image: flxxyz / PHP: 7.3-fpm
volumes:
-. / wwwroot / site name / var / www / HTML
networks:
- site
-
newly build nginx.conf File to Wwwroot / site name / conf Save in directory
server
{
listen 80;
server_ Name example.com; # pay attention to modify the domain name
root / usr / share / nginx / HTML / site directory / WWW;
index index.html index.htm index.php;
#; you can use some default rewrite rules (laravel, phpwind, thinkpph, Typecho, WordPress), and add and place the
include / etc / nginx / rewrite. D / Typecho. Rewrite in nginx / rewrite. D;
location ~ \.php$
{
fastcgi_ Pass site name: 9000;
fastcgi_ index index.php;
include fastcgi_ params;
fastcgi_ param SCRIPT_ FILENAME /var/www/html/$fastcgi_ script_ name;
}
error_ Log / var / log / nginx / site name. Error. Log;
access_ Log / var / log / nginx / site name. Access. Log;
}
Volumes:
-. / wwwroot / site name / conf / FPM. Conf / usr / local / etc / PHP FPM. D / www.conf -. / wwwroot / site name / conf / PHP. Ini / usr / local / etc / PHP / PHP. Ini
Add cli application
CLI container open port 9000-9050
default-cli:
container_ name: default-cli
restart: always
image: flxxyz/php:7.3-cli
volumes:
- ./wwwroot/default-cli/www:/usr/src/myapp
command: php /usr/src/myapp/index.php
networks:
- site
Using laravels
laravels:
container_ Name: laraves
restart: always
image: flxxyz / PHP: 7.3-cli
ports:
- "custom TCP local port: 9001 / TCP"
- "custom UDP local port: 9002 / UDP"
volumes:
-. / wwwroot / laravels / www: usr / SRC / myapp
command: PHP bin / laravels start
networks:
- site
The specific code can be viewed docker-compose.yml How to realize TCP, UDP, websocket related functions app/Services
Composer installation dependency
Flxxyz / PHP: 7.3-cli container integrated with composer
composer:
container_ Name: composer
image: Composer: latest
volumes:
-. / wwwroot / site name / www: app
command: composer install
networks:
- site
ngx-fancyindex
Some additional PHP extensions
-
bcmath -
gd -
inotify -
intl -
libxml -
mcrypt -
memcached -
mongodb -
mysqli -
mysqlnd -
openssl -
pcntl -
opcache -
pcntl -
pdo_ mysql -
pdo_ sqlite -
readline -
redis -
SimpleXML -
soap -
sockets -
sqlite3 -
standard -
Spool (only flxxyz/php:7.3-cli Installation) -
xml -
xmlrpc -
xmlwriter -
xsl -
tokenizer -
yaml -
zip -
zlib
data base
mariadb
db:
container_ name: db
restart: always
image: mariadb:10.5-focal
environment:
MYSQL_ ROOT_ PASSWORD: 12345678
volumes:
- ./database/mariadb:/var/lib/mysql
networks:
- site
See more settings MariaDB description
mongo
db:
container_ name: db
restart: always
image: mongo:4.4-bionic
environment:
MONGO_ INITDB_ ROOT_ USERNAME: root
MONGO_ INITDB_ ROOT_ PASSWORD: 12345678
volumes:
- ./database/mongo:/data/db
networks:
- site
See more settings Mongo description
cache
redis
cache:
container_ name: cache
restart: always
image: redis:6-alpine
networks:
- site
Persistent storage
volumes:
- ./database/redis:/data
command: redis-server --appendonly yes
See more settings Redis description
memcached
cache:
container_ name: cache
restart: always
image: memcached:1.6-alpine
networks:
- site
Set the size of used memory
command: memcached -m 64
See more settings Mamcached description
Search Engines
elasticsearch
es01:
container_ name: es01
restart: always
image: elasticsearch:7.9.0
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_ hosts=es02
- cluster.initial_ master_ nodes=es01,es02
- bootstrap.memory_ lock=true
- "ES_ JAVA_ OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./database/es/node01:/usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
networks:
- site
es02:
container_ name: es02
restart: always
image: elasticsearch:7.9.1
environment:
- node.name=es02
- cluster.name=es-docker-cluster
- discovery.seed_ hosts=es01
- cluster.initial_ master_ nodes=es01,es02
- bootstrap.memory_ lock=true
- "ES_ JAVA_ OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./database/es/node02:/usr/share/elasticsearchdata
networks:
- site
See more settings Elasticsearch description
Message queuing
rabbitmq
amqp:
container_ name: amqp
restart: always
image: rabbitmq:3.8
environment:
- RABBITMQ_ DEFAULT_ USER=amqp
- RABBITMQ_ DEFAULT_ PASS=12345678
volumes:
- ./database/amqp:/var/lib/rabbitmq
ports:
- "15672:15672"
networks:
- site
See more settings Rabbitmq description
DNS
pi-hole
dns:
container_ name: dns
restart: unless-stopped
image: pihole/pihole:latest
environment:
- TZ='Asia/Shanghai'
- WEBPASSWORD=12345678
volumes:
- ./database/pihole/:/etc/pihole/:z
- ./database/dnsmasq.d/:/etc/dnsmasq.d/:z
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "9080:80"
- "9443:443"
networks:
- site
See more settings Pihole description
The version used when configuring the instance
docker
version: 19.03.12
docker-compose
version: 1.24.2 compose file format: 3.7