diff --git a/ubuntu-7.4/Dockerfile b/ubuntu-7.4/Dockerfile index 4263cac..9e0a060 100644 --- a/ubuntu-7.4/Dockerfile +++ b/ubuntu-7.4/Dockerfile @@ -69,7 +69,7 @@ RUN \ ## # Install composer ## - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --1 \ && composer global require hirak/prestissimo \ ## @@ -115,6 +115,7 @@ ENV \ # This also works correctly with flynn: # https://github.com/flynn/flynn/issues/3213#issuecomment-237307457 PORT="8080" \ + INTERNAL_PORT="8888" \ # Use custom users for nginx and php-fpm WEB_USER="wordpress" \ WEB_GROUP="web" \ diff --git a/ubuntu-7.4/rootfs/etc/cont-init.d/00-render-templates b/ubuntu-7.4/rootfs/etc/cont-init.d/00-render-templates index 56f69f3..e1ccd79 100755 --- a/ubuntu-7.4/rootfs/etc/cont-init.d/00-render-templates +++ b/ubuntu-7.4/rootfs/etc/cont-init.d/00-render-templates @@ -29,7 +29,7 @@ echo "[cont-init.d] Substituting env into configuration files..." ## # Nginx doesn't support env variables in config files so we will have to do this in hacky way instead ## -VARS='$PORT:$WEB_ROOT:$WEB_USER:$WEB_GROUP:$NGINX_ACCESS_LOG:$NGINX_ERROR_LOG:$NGINX_ERROR_LEVEL:$NGINX_INCLUDE_DIR:$NGINX_MAX_BODY_SIZE:$NGINX_BODY_BUFFER_SIZE:$NGINX_FASTCGI_TIMEOUT:$WP_ENV:$NGINX_CACHE_KEY' +VARS='$PORT:$INTERNAL_PORT:$WEB_ROOT:$WEB_USER:$WEB_GROUP:$NGINX_ACCESS_LOG:$NGINX_ERROR_LOG:$NGINX_ERROR_LEVEL:$NGINX_INCLUDE_DIR:$NGINX_MAX_BODY_SIZE:$NGINX_BODY_BUFFER_SIZE:$NGINX_FASTCGI_TIMEOUT:$WP_ENV:$NGINX_CACHE_KEY' render_env_tmpl "$VARS" /etc/nginx/nginx.conf ## diff --git a/ubuntu-7.4/rootfs/etc/nginx/env.conf b/ubuntu-7.4/rootfs/etc/nginx/env.conf index 1a133cb..827dd60 100644 --- a/ubuntu-7.4/rootfs/etc/nginx/env.conf +++ b/ubuntu-7.4/rootfs/etc/nginx/env.conf @@ -1,6 +1,7 @@ # Set custom enviromental variables that we need with lua here # These are used to dynamically load env PORT; +env INTERNAL_PORT; env WEB_ROOT; env NGINX_MAX_BODY_SIZE; env NGINX_TIMEOUT; diff --git a/ubuntu-7.4/rootfs/etc/nginx/nginx.conf b/ubuntu-7.4/rootfs/etc/nginx/nginx.conf index 47e5623..81e5065 100644 --- a/ubuntu-7.4/rootfs/etc/nginx/nginx.conf +++ b/ubuntu-7.4/rootfs/etc/nginx/nginx.conf @@ -103,10 +103,26 @@ http { pagespeed LoadFromFile "$scheme://$host/wp-content/themes/" "${WEB_ROOT}/wp/wp-content/themes/"; server { - # This is the default server for this container + # This is an internal proxy for the main server listen ${PORT} default_server; server_name _; + location / { + proxy_set_header Host $host; + + # Include custom proxy configs from project + include ${NGINX_INCLUDE_DIR}/proxy/*.conf; + include ${NGINX_INCLUDE_DIR}/environments/${WP_ENV}/proxy/*.conf; + + proxy_pass http://127.0.0.1:${INTERNAL_PORT}; + } + } + + server { + # This is the default server for this container + listen 127.0.0.1:${INTERNAL_PORT}; + server_name _; + root ${WEB_ROOT}; # Use index.php if it exists but also allow static websites in subfolders