diff --git a/README.md b/README.md index 03ad8b1..f509d4c 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ docker run -p 80:8080 \ -e MULTISITE=yes \ -e AUTO_LETS_ENCRYPT=yes \ -e REDIRECT_HTTP_TO_HTTPS=yes \ - -l bunkerized.nginx.AUTOCONF \ + -l bunkerized-nginx.AUTOCONF \ bunkerity/bunkerized-nginx ``` @@ -568,6 +568,12 @@ Default value : */www* Context : *global* The default folder where nginx will search for web files. Don't change it unless you want to make your own image. +`ROOT_SITE_SUBFOLDER` +Values : *\* +Default value : +Context : *global*, *multisite* +The subfolder where nginx will search for site web files. + `LOG_FORMAT` Values : *\* Default value : *$host $remote_addr - $remote_user \[$time_local\] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"* diff --git a/entrypoint/defaults.sh b/entrypoint/defaults.sh index f5fc30c..801e76b 100644 --- a/entrypoint/defaults.sh +++ b/entrypoint/defaults.sh @@ -87,6 +87,7 @@ AUTH_BASIC_USER="${AUTH_BASIC_USER-changeme}" AUTH_BASIC_PASSWORD="${AUTH_BASIC_PASSWORD-changeme}" USE_CUSTOM_HTTPS="${USE_CUSTOM_HTTPS-no}" ROOT_FOLDER="${ROOT_FOLDER-/www}" +ROOT_SITE_SUBFOLDER="${ROOT_SITE_SUBFOLDER-}" LOGROTATE_MINSIZE="${LOGROTATE_MINSIZE-10M}" LOGROTATE_MAXAGE="${LOGROTATE_MAXAGE-7}" LOGROTATE_CRON="${LOGROTATE_CRON-0 0 * * *}" diff --git a/entrypoint/site-config.sh b/entrypoint/site-config.sh index 85075b8..6c45921 100644 --- a/entrypoint/site-config.sh +++ b/entrypoint/site-config.sh @@ -22,6 +22,10 @@ if [ "$MULTISITE" = "yes" ] ; then done fi +if [ "$ROOT_SITE_SUBFOLDER" != "" ] ; then + ROOT_FOLDER="${ROOT_FOLDER}/${ROOT_SITE_SUBFOLDER}" +fi + set | grep -E -v "^(HOSTNAME|PWD|PKG_RELEASE|NJS_VERSION|SHLVL|PATH|_|NGINX_VERSION|HOME)=" > "${NGINX_PREFIX}nginx.env" if [ "$MULTISITE" = "yes" ] ; then for server in $SERVER_NAME ; do diff --git a/examples/custom-subfolder/apps/app1.website.com/web-files/index.php b/examples/custom-subfolder/apps/app1.website.com/web-files/index.php new file mode 100644 index 0000000..277ebfb --- /dev/null +++ b/examples/custom-subfolder/apps/app1.website.com/web-files/index.php @@ -0,0 +1,5 @@ + diff --git a/examples/custom-subfolder/apps/app2.website.com/web-files/index.php b/examples/custom-subfolder/apps/app2.website.com/web-files/index.php new file mode 100644 index 0000000..4746538 --- /dev/null +++ b/examples/custom-subfolder/apps/app2.website.com/web-files/index.php @@ -0,0 +1,5 @@ + diff --git a/examples/custom-subfolder/apps/app3.website.com/another-folder/index.php b/examples/custom-subfolder/apps/app3.website.com/another-folder/index.php new file mode 100644 index 0000000..6efd79f --- /dev/null +++ b/examples/custom-subfolder/apps/app3.website.com/another-folder/index.php @@ -0,0 +1,5 @@ + diff --git a/examples/custom-subfolder/docker-compose.yml b/examples/custom-subfolder/docker-compose.yml new file mode 100644 index 0000000..a2da3b8 --- /dev/null +++ b/examples/custom-subfolder/docker-compose.yml @@ -0,0 +1,47 @@ +version: '3' + +services: + + myreverse: + image: bunkerity/bunkerized-nginx + restart: always + ports: + - 80:8080 + - 443:8443 + volumes: + - ./apps:/www:ro + - ./letsencrypt:/etc/letsencrypt + environment: + - MULTISITE=yes + - SERVER_NAME=app1.website.com app2.website.com app3.website.com # replace with your domains + - DISABLE_DEFAULT_SERVER=yes + - REDIRECT_HTTP_TO_HTTPS=yes + - AUTO_LETS_ENCRYPT=yes + - USE_CLIENT_CACHE=yes + - USE_GZIP=yes + - ROOT_SITE_SUBFOLDER=web-files + - app1.website.com_REMOTE_PHP=app1 + - app1.website.com_REMOTE_PHP_PATH=/var/www/html + - app2.website.com_REMOTE_PHP=app2 + - app2.website.com_REMOTE_PHP_PATH=/var/www/html + - app3.website.com_REMOTE_PHP=app3 + - app3.website.com_REMOTE_PHP_PATH=/var/www/html + - app3.website.com_ROOT_SITE_SUBFOLDER=another-folder + + app1: + image: php:fpm + restart: always + volumes: + - ./apps/app1.website.com/web-files:/var/www/html + + app2: + image: php:fpm + restart: always + volumes: + - ./apps/app2.website.com/web-files:/var/www/html + + app3: + image: php:fpm + restart: always + volumes: + - ./apps/app3.website.com/another-folder:/var/www/html