33If You want to build a reverse proxy website with Drupal at short time;
44
55#### Full stack Proxy Nginx Drupal:
6- <p align="left"> <a href="https://drupal.org/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/docker-library/docs/e405066455691ca2429eb8094777f12d2dad8f91/drupal/logo.svg?sanitize=true" alt="Drupal" height="40" width="40"/> </a> <a href="https://www.docker.com/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/docker/docker.png" alt="docker" width="40" height="40" width="40"/> </a> <a href="https://mariadb.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/5877084?s=200&v=4" alt="mariadb" height="50" width="50"/> </a> <a href="https://www.nginx.com" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1412239?s=200&v=4" alt="nginx" height="40" width="40"/> </a> <a href="https://www.php.net" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/25158?s=200&v=4" alt="php" height="40" width="40"/> </a> <a href="https://redis.io" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1529926?s=200&v=4" alt="redis" height="40" width="40"/> </a> <a href="https://www.varnish-software.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/577014?s=200&v=4" alt="varnish" height="40" width="40"/> </a> <a href="#" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png" alt="Bash" height="50" width="50" /> </a>
7- <a href =" https://www.phpmyadmin.net/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1351977?s=200&v=4 " alt =" phpmyadmin " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://letsencrypt.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/17889013?s=200&v=4 " alt =" letsencrypt " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://www.portainer.io/?hsLang=en " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/22225832?s=200&v=4 " alt =" portainer " height =" 40 " width =" 40 " /> </a >  ;  ;  ; <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a > </p >
6+ <p align =" left " > <a href =" https://drupal.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/docker-library/docs/e405066455691ca2429eb8094777f12d2dad8f91/drupal/logo.svg?sanitize=true " alt =" Drupal " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
7+ <a href =" https://docs.docker.com/compose/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/docker/compose/v2/logo.png " alt =" docker compose " width =" 40 " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
8+ <a href =" https://mariadb.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/5877084?s=200&v=4 " alt =" mariadb " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
9+ <a href =" https://dev.mysql.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/2452804?s=200&v=4 " alt =" mysql " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
10+ <a href =" https://www.nginx.com " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1412239?s=200&v=4 " alt =" nginx " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
11+ <a href =" https://www.php.net " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/25158?s=200&v=4 " alt =" php " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
12+ <a href =" https://redis.io " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1529926?s=200&v=4 " alt =" redis " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
13+ <a href =" https://www.varnish-software.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/577014?s=200&v=4 " alt =" varnish " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
14+ <a href =" # " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png " alt =" Bash " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
15+ <a href =" https://www.phpmyadmin.net/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1351977?s=200&v=4 " alt =" phpmyadmin " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
16+ <a href =" https://certbot.eff.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/17889013?s=200&v=4 " alt =" certbot " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
17+ <a href =" https://letsencrypt.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/9289019?s=200&v=4 " alt =" letsencrypt " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
18+ <a href =" https://www.portainer.io/?hsLang=en " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/22225832?s=200&v=4 " alt =" portainer " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
19+ <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a > </p >
820
921Plus, manage docker containers with Portainer.
1022
23+ #### Supported CPU architectures:
24+ <p align =" left " > arm64/aarch64, x86-64 </p >
25+
26+ #### Supported Linux Package Manage Systems:
27+ <p align =" left " > apk, dnf, yum, apt/apt-get, zypper </p >
28+
29+ #### Supported Linux Operation Systems:
30+ <p align =" left " > <a href =" https://alpinelinux.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/7600810?s=200&v=4 " alt =" alpine linux " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
31+ <a href =" https://fedoraproject.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/e6b1e7f0fb8d0bf920bd719c7289243138bdc1b4/topics/fedora/fedora.png " alt =" fedora " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
32+ <a href =" https://www.centos.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/79192?s=200&v=4 " alt =" centos " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
33+ <a href =" https://www.debian.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1854028?s=200&v=4 " alt =" debian " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
34+ <a href =" https://ubuntu.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/4604537?s=200&v=4 " alt =" ubuntu " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
35+ <a href =" https://www.raspberrypi.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/1294177?s=200&v=4 " alt =" ubuntu " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
36+ <a href =" https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/33972111?s=200&v=4 " alt =" redhat on s390x (IBM Z) " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
37+ <a href =" https://www.suse.com/products/server/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/623819?s=200&v=4 " alt =" opensuse on s390x (IBM Z) " height =" 40 " width =" 40 " /> </a > </p >
38+
39+ ##### Note: Fedora 37, 39 and alpine linux x86-64 compatible, could not try sles IBM Z s390x, rhel IBM Z s390x and raspberrypi.
40+
1141#### With this project you can quickly run the following:
1242
13- - [ Drupal] ( https://hub.docker.com/_/drupal ) - [ php-fpm] ( https://hub.docker.com/_/php?tab=tags&page=1&name=fpm )
43+ - [ Drupal] ( https://hub.docker.com/_/drupal ) - [ php-fpm] ( https://hub.docker.com/_/php )
1444- [ webserver (apache2/httpd)] ( https://hub.docker.com/_/httpd )
1545- [ proxy (nginx)] ( https://hub.docker.com/_/nginx )
1646- [ certbot (letsencrypt)] ( https://hub.docker.com/r/certbot/certbot )
1747- [ phpMyAdmin] ( https://hub.docker.com/r/phpmyadmin/phpmyadmin/ )
18- - [ database ] ( https://hub.docker.com/_/mariadb )
48+ - [ databaseMariadb ] ( https://hub.docker.com/_/mariadb ) [ databaseMysql ] ( https://hub.docker.com/_/mysql )
1949- [ redis] ( https://hub.docker.com/_/redis )
50+ - [ varnish] ( https://hub.docker.com/_/varnish )
2051- [ backup] ( https://hub.docker.com/r/offen/docker-volume-backup )
2152
2253#### For certbot (letsencrypt) certificate:
@@ -43,8 +74,9 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
4374 - [Webserver](#webserver)
4475 - [Database](#database)
4576 - [Redis](#redis)
77+ - [Varnish](#varnish)
4678 - [phpMyAdmin](#phpmyadmin)
47- - [backup](#backup)
79+ - [backup](#backup)
4880
4981## Automatic
5082
@@ -71,7 +103,7 @@ Make sure you have the latest versions of **Docker** and **Docker Compose** inst
71103- [ How install docker] ( https://docs.docker.com/engine/install/ )
72104- [ How install docker compose] ( https://docs.docker.com/compose/install/ )
73105
74- Clone this repository or copy the files from this repository into a new folder. In the ** docker-compose.yml ** file you may change the database from MariaDB to MySQL.
106+ Clone this repository or copy the files from this repository into a new folder.
75107
76108Make sure to [ add your user to the ` docker ` group] ( https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user ) .
77109
@@ -80,6 +112,7 @@ Make sure to [add your user to the `docker` group](https://docs.docker.com/insta
80112### Configuration
81113
82114download with
115+
83116```
84117git clone https://github.com/damalis/full-stack-proxy-nginx-drupal-for-everyone-with-docker-compose.git
85118```
@@ -96,26 +129,36 @@ Copy the example environment into `.env`
96129cp env.example .env
97130```
98131
99- Edit the ` .env ` file to change values of ``` LOCAL_TIMEZONE ``` , ``` DOMAIN_NAME ``` , ``` DIRECTORY_PATH ``` , ``` LETSENCRYPT_EMAIL ``` , ``` DB_USER ``` , ``` DB_PASSWORD ``` , ``` DB_NAME ``` , ``` MYSQL_ROOT_PASSWORD ``` , ``` PMA_CONTROLUSER ``` , ``` PMA_CONTROLPASS ``` , ``` PMA_HTPASSWD_USERNAME ``` and ``` PMA_HTPASSWD_PASSWORD ``` .
132+ Edit the ` .env ` file to change values of ``` LOCAL_TIMEZONE ``` , ``` DOMAIN_NAME ``` , ``` DIRECTORY_PATH ``` , ``` LETSENCRYPT_EMAIL ``` , ``` DB_USER ``` , ``` DB_PASSWORD ``` , ``` DB_NAME ``` , ``` MYSQL_ROOT_PASSWORD ``` , ``` DATABASE_IMAGE_NAME ``` , ``` DATABASE_CONT_NAME ``` , ``` DATABASE_PACKAGE_MANAGER ``` , ``` DATABASE_AUTHENTICATION_PLUGIN ``` , ``` DATABASE_ADMIN_COMMANDLINE ``` , ``` PMA_CONTROLUSER ``` , ``` PMA_CONTROLPASS ``` , ``` PMA_HTPASSWD_USERNAME ``` , ``` PMA_HTPASSWD_PASSWORD ``` and ``` VARNISH_VERSION ``` .
100133
101134LOCAL_TIMEZONE=[ to see local timezones] ( https://docs.diladele.com/docker/timezones.html )
102135
103- DIRECTORY_PATH=``` pwd ``` at command line
136+ DIRECTORY_PATH=``` pwd ``` at command line\
137+ DATABASE_IMAGE_NAME=``` mariadb ``` or ``` mysql ``` \
138+ DATABASE_CONT_NAME=``` mariadb ``` , ``` mysql ``` or ``` custom name ``` \
139+ DATABASE_PACKAGE_MANAGER=``` apt-get update && apt-get install -y gettext-base ``` for mariadb, ``` microdnf install -y gettext ``` for mysql\
140+ DATABASE_AUTHENTICATION_PLUGIN=``` mysql_native_password ``` for mariadb, ``` caching_sha2_password ``` for mysql\
141+ DATABASE_ADMIN_COMMANDLINE=``` mariadb-admin ``` for mariadb, ``` mysqladmin ``` for mysql\
142+ VARNISH_VERSION=``` latest ``` for centos version 9+ and fedora, ``` stable ``` for the others
104143
105144and
106145
107146```
108147cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apache2/sites-available/default-ssl.conf
109148```
110-
111149change example.com to your domain name in ``` ./phpmyadmin/apache2/sites-available/default-ssl.conf ``` file.
112150
151+ ```
152+ cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
153+ ```
154+ change pma_controluser, db_authentication_plugin and db_authentication_password in ``` ./database/phpmyadmin/sql/create_tables.sql.template ``` file.
155+
113156### Installation
114157
115158Firstly: will create external volume
116159
117160```
118- docker volume create --driver local --opt type=none --opt device=${DIRECTORY_PATH }/certbot --opt o=bind certbot-etc
161+ docker volume create --driver local --opt type=none --opt device=${PWD }/certbot --opt o=bind certbot-etc
119162```
120163
121164```
@@ -137,6 +180,7 @@ For convenience you may add a new entry into your hosts file.
137180```
138181docker compose -f portainer-docker-compose.yml -p portainer up -d
139182```
183+
140184manage docker with [ Portainer] ( https://www.portainer.io/ ) is the definitive container management tool for Docker, Docker Swarm with it's highly intuitive GUI and API.
141185
142186You can also visit ` https://example.com:9001 ` to access portainer after starting the containers.
@@ -175,7 +219,8 @@ To stop and remove all the containers use the `down` command:
175219docker compose down
176220```
177221
178- to remove portainer and the other containers
222+ to remove portainer and the other containers:
223+
179224```
180225docker rm -f $(docker ps -a -q)
181226```
@@ -186,13 +231,26 @@ Use `-v` if you need to remove the database volume which is used to persist the
186231docker compose down -v
187232```
188233
189- to remove external certbot-etc and portainer and the other volumes
234+ to remove external certbot-etc and portainer and the other volumes:
190235
191236```
192237docker volume rm $(docker volume ls -q)
193238```
194239
195- to remove portainer and the other images
240+ Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
241+
242+ ```
243+ docker system prune
244+ ```
245+
246+ To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
247+
248+ ```
249+ docker system prune -a
250+ ```
251+
252+ to remove portainer and the other images:
253+
196254```
197255docker rmi $(docker image ls -q)
198256```
@@ -256,17 +314,71 @@ ADVANCED OPTIONS -> Host: database
256314
257315[ https://mariadb.com/kb/en/configuring-mariadb-with-option-files/ ] ( https://mariadb.com/kb/en/configuring-mariadb-with-option-files/ )
258316
317+ [ https://dev.mysql.com/doc/refman/8.3/en/ ] ( https://dev.mysql.com/doc/refman/8.3/en/ )
318+
259319#### Redis
260320
261- if there isn't these lines, Edit Drupal settings file: ./drupal/sites/default/settings.php and add these lines at the bottom of the file:
321+ at page https://example.com/en/admin/modules , filter: redis and check then install.
322+
323+ if there isn't these lines, Edit Drupal settings file: ``` ./drupal/sites/default/settings.php ``` and add these lines at the bottom of the file:
262324
263325```
326+ $settings['redis.connection']['interface'] = 'PhpRedis';
327+ // Host ip address.
264328$settings['redis.connection']['host'] = 'redis';
265- $settings['redis.connection']['port'] = 6379;
329+
266330$settings['cache']['default'] = 'cache.backend.redis';
267- $settings['redis.connection']['base'] = 8;
331+ // Redis port.
332+ $settings['redis.connection']['port'] = '6379';
333+ $settings['redis.connection']['base'] = 12;
334+ // Password of redis updated in php.ini file.
335+ // $settings['redis.connection']['password'] = "password";
336+ $settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
337+ $settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
338+ $settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
268339```
269340
341+ Create ``` ./drupal/sites/default/files/services.yml ``` inisde default folder and add the below code in it.
342+
343+ ```
344+ services:
345+ # Cache tag checksum backend. Used by redis and most other cache backend
346+ # to deal with cache tag invalidations.
347+ cache_tags.invalidator.checksum:
348+ class: Drupal\redis\Cache\RedisCacheTagsChecksum
349+ arguments: ['@redis.factory']
350+ tags:
351+ - { name: cache_tags_invalidator }
352+
353+ # Replaces the default lock backend with a redis implementation.
354+ lock:
355+ class: Drupal\Core\Lock\LockBackendInterface
356+ factory: ['@redis.lock.factory', get]
357+
358+ # Replaces the default persistent lock backend with a redis implementation.
359+ lock.persistent:
360+ class: Drupal\Core\Lock\LockBackendInterface
361+ factory: ['@redis.lock.factory', get]
362+ arguments: [true]
363+
364+ # Replaces the default flood backend with a redis implementation.
365+ flood:
366+ class: Drupal\Core\Flood\FloodInterface
367+ factory: ['@redis.flood.factory', get]
368+ ```
369+
370+ #### Varnish
371+
372+ at page https://example.com/en/admin/modules , filter: purge and check then install.
373+
374+ Varnish Server Hostname: varnish
375+
376+ Varnish Server Port: 8080
377+
378+ Scheme: http
379+
380+ [ This link is to complete configure Varnish] ( https://www.varnish-software.com/developers/tutorials/configuring-varnish-drupal/#4-configure-caching-and-purging-in-drupal )
381+
270382All necessary changes to sites/default and sites/default/settings.php have been made, so you should remove write permissions to them now in order to avoid security risks.
271383
272384```
0 commit comments