From b21af5d2db73debc5469f024dd3360691bab94ba Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Mon, 28 Oct 2024 14:06:00 +0100 Subject: [PATCH] feat(shopware): add nginx to container for aws environment --- .env.template | 5 +++++ images/shopware/etc/nginx/http.d/default.conf | 2 +- images/shopware/scripts/_start-nginx.sh | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.env.template b/.env.template index 0bcbd8f..163e6d8 100644 --- a/.env.template +++ b/.env.template @@ -32,6 +32,11 @@ DOCKER_CACHE_MODE=max # TODO: Find a way to set this based on the architecture of the runner. DOCKER_BUILD_PLATFORMS=linux/arm64 +### +# Set to 0 for a separate Nginx container, to 1 to include Nginx in the platform (php) container +### +WITH_NGINX=1 + # Don't try and push the image to Docker Hub. DOCKER_PUSH=0 diff --git a/images/shopware/etc/nginx/http.d/default.conf b/images/shopware/etc/nginx/http.d/default.conf index 757a4cb..d711c8b 100644 --- a/images/shopware/etc/nginx/http.d/default.conf +++ b/images/shopware/etc/nginx/http.d/default.conf @@ -46,7 +46,7 @@ server { # Let php-fpm handle .php files location ~ \.php$ { - fastcgi_pass localhost:9000; + fastcgi_pass php:9000; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi.conf; fastcgi_param HTTP_PROXY ""; diff --git a/images/shopware/scripts/_start-nginx.sh b/images/shopware/scripts/_start-nginx.sh index f41065a..118b7b8 100755 --- a/images/shopware/scripts/_start-nginx.sh +++ b/images/shopware/scripts/_start-nginx.sh @@ -8,6 +8,10 @@ start-nginx() { return fi + # replace docker php fpm location with local one in nginx default config + sed -i -e 's|php:9000;|localhost:9000;|g' /etc/nginx/http.d/default.conf + + # start nginx nginx; if [ "$?" -eq 0 ]; then