Skip to content

Commit 876f566

Browse files
committed
Updated docker compose setup
1 parent e574679 commit 876f566

File tree

6 files changed

+80
-26
lines changed

6 files changed

+80
-26
lines changed

.docker/nginx.conf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
worker_processes auto;
22

3-
error_log /var/log/nginx/error.log notice;
3+
error_log /dev/stderr notice;
44
pid /tmp/nginx.pid;
55

66
events {
@@ -26,11 +26,9 @@ http {
2626
'$status $body_bytes_sent "$http_referer" '
2727
'"$http_user_agent" "$http_x_forwarded_for"';
2828

29-
access_log /var/log/nginx/access.log main;
29+
access_log /dev/stdout main;
3030

3131
sendfile on;
32-
#tcp_nopush on;
33-
3432
keepalive_timeout 65;
3533

3634
gzip on;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
server {
2+
listen ${NGINX_PORT};
3+
server_name localhost;
4+
5+
root ${NGINX_WEB_ROOT};
6+
7+
client_max_body_size ${NGINX_MAX_BODY_SIZE};
8+
9+
location / {
10+
# try to serve file directly, fallback to index.php
11+
try_files $uri /index.php$is_args$args;
12+
}
13+
14+
# Protect files and directories from prying eyes.
15+
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
16+
deny all;
17+
return 404;
18+
}
19+
20+
location ~ ^/index\.php(/|$) {
21+
fastcgi_buffers 16 32k;
22+
fastcgi_buffer_size 64k;
23+
fastcgi_busy_buffers_size 64k;
24+
25+
fastcgi_pass ${NGINX_FPM_SERVICE};
26+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
27+
include fastcgi_params;
28+
29+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
30+
fastcgi_param DOCUMENT_ROOT $realpath_root;
31+
32+
internal;
33+
}
34+
35+
location ~ \.php$ {
36+
return 404;
37+
}
38+
39+
# Send log message to files symlinked to stdout/stderr.
40+
error_log /dev/stderr;
41+
access_log /dev/stdout main;
42+
}

docker-compose.dev.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
phpfpm:
64
environment:

docker-compose.redirect.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
nginx:
64
labels:

docker-compose.server.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
networks:
53
frontend:
64
external: true
@@ -31,12 +29,15 @@ services:
3129
- frontend
3230
depends_on:
3331
- phpfpm
34-
ports:
35-
- '8080'
3632
volumes:
37-
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
33+
- ./.docker/templates:/etc/nginx/templates:ro
3834
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:ro
39-
- ./:/app:rw
35+
- .:/app
36+
environment:
37+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
38+
NGINX_WEB_ROOT: /app/public
39+
NGINX_PORT: 8080
40+
NGINX_MAX_BODY_SIZE: 5M
4041
labels:
4142
- "traefik.enable=true"
4243
- "traefik.docker.network=frontend"

docker-compose.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
networks:
53
frontend:
64
external: true
@@ -31,8 +29,8 @@ services:
3129
environment:
3230
- PHP_XDEBUG_MODE=${PHP_XDEBUG_MODE:-off}
3331
- PHP_MAX_EXECUTION_TIME=30
34-
- PHP_MEMORY_LIMIT=512M
35-
# Depending on the setup you may have to remove --read-envelope-from from msmtp (cf. https://marlam.de/msmtp/msmtp.html) or use SMTP to send mail
32+
- PHP_MEMORY_LIMIT=256M
33+
# Depending on the setup, you may have to remove --read-envelope-from from msmtp (cf. https://marlam.de/msmtp/msmtp.html) or use SMTP to send mail
3634
- PHP_SENDMAIL_PATH=/usr/bin/msmtp --host=mail --port=1025 --read-recipients --read-envelope-from
3735
- DOCKER_HOST_DOMAIN=${COMPOSE_DOMAIN}
3836
- COMPOSER_VERSION=2
@@ -52,12 +50,31 @@ services:
5250
ports:
5351
- '8080'
5452
volumes:
55-
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
53+
- ./.docker/templates:/etc/nginx/templates:ro
5654
- .:/app
55+
environment:
56+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
57+
NGINX_WEB_ROOT: /app/public
58+
NGINX_PORT: 8080
59+
NGINX_MAX_BODY_SIZE: 5M
5760
labels:
5861
- "traefik.enable=true"
5962
- "traefik.docker.network=frontend"
6063
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`)"
61-
# HTTPS config - uncomment to enable redirect from :80 to :443
62-
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
63-
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
64+
# HTTPS config - uncomment to enable redirect from :80 to :443
65+
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
66+
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
67+
68+
mail:
69+
image: axllent/mailpit
70+
networks:
71+
- app
72+
- frontend
73+
ports:
74+
- "1025"
75+
- "8025"
76+
labels:
77+
- "traefik.enable=true"
78+
- "traefik.docker.network=frontend"
79+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}mail.rule=Host(`mail-${COMPOSE_DOMAIN}`)"
80+
- "traefik.http.services.${COMPOSE_PROJECT_NAME}mail.loadbalancer.server.port=8025"

0 commit comments

Comments
 (0)