From 709658fc0ae9855aa2d3b6df3818ef590882b127 Mon Sep 17 00:00:00 2001 From: Benedikt Schmitz Date: Thu, 6 Jul 2017 17:08:41 +0200 Subject: [PATCH] [TASK] Make document root configurable --- .env | 3 ++- Docker/nginx/default.conf.template | 2 +- Docker/nginx/run_nginx.sh | 2 +- README.md | 2 +- docker-compose.yml | 7 ++++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env b/.env index dd43551..f6ce164 100644 --- a/.env +++ b/.env @@ -4,4 +4,5 @@ MYSQL_USER=neos MYSQL_PASSWORD=neos FLOW_CONTEXT=Development/Docker -NGINX_PORT=1234 \ No newline at end of file +NGINX_PORT=1234 +NGINX_DOCUMENT_ROOT=/data/Web \ No newline at end of file diff --git a/Docker/nginx/default.conf.template b/Docker/nginx/default.conf.template index 7ef4880..147dff3 100644 --- a/Docker/nginx/default.conf.template +++ b/Docker/nginx/default.conf.template @@ -1,7 +1,7 @@ server { listen ${NGINX_PORT}; server_name localhost; - root /data/Web; + root ${NGINX_DOCUMENT_ROOT}; index index.php; client_body_temp_path /tmp/nginx; diff --git a/Docker/nginx/run_nginx.sh b/Docker/nginx/run_nginx.sh index bc7c025..7adce85 100644 --- a/Docker/nginx/run_nginx.sh +++ b/Docker/nginx/run_nginx.sh @@ -3,5 +3,5 @@ set -e set -u -envsubst '${FLOW_CONTEXT} ${NGINX_PORT}' < /default.conf.template > /etc/nginx/conf.d/default.conf +envsubst '${FLOW_CONTEXT} ${NGINX_PORT} ${NGINX_DOCUMENT_ROOT}' < /default.conf.template > /etc/nginx/conf.d/default.conf nginx -g "daemon off;" \ No newline at end of file diff --git a/README.md b/README.md index 16d8f7b..dc4ba2f 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,4 @@ If you want a different port than 1234 you can edit the environment variable `NG ### How to change the document root? -To change the document root just edit the configuration file located under `Docker/nginx/default.conf.template` \ No newline at end of file +To change the document root just edit the environment variable `NGINX_DOCUMENT_ROOT` in the [.env](https://github.com/egobude/docker-neos-template/blob/master/.env) file. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b58bb69..0f8cb54 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: environment: FLOW_CONTEXT: "${FLOW_CONTEXT}" volumes: - - "./Data:/data:cached" + - "./Data:/data" nginx: build: ./Docker/nginx @@ -21,9 +21,10 @@ services: environment: FLOW_CONTEXT: "${FLOW_CONTEXT}" NGINX_PORT: "${NGINX_PORT}" + NGINX_DOCUMENT_ROOT: "${NGINX_DOCUMENT_ROOT}" command: /bin/sh -c "/run_nginx.sh" - volumes: - - "./Data:/data" + volumes_from: + - php redis: build: ./Docker/redis