diff --git a/Dockerfile b/Dockerfile index 20fa4a7..ae1774e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.21 RUN \ apk -U upgrade && \ - apk add tini nginx gettext-envsubst openssh-server php84 php84-fpm php83 php83-fpm php82 php82-fpm + apk add tini nginx openssh-server php84 php84-fpm php83 php83-fpm php82 php82-fpm COPY rootfs / diff --git a/README.md b/README.md index c7a29fd..089159a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ services: volumes: - ./www:/data/www - ./ssh:/ssh # add authorized_keys file here + - ./extra_nginx.conf:/etc/nginx/custom.d/extra.conf # optional environment: PHP: php84 # none (default), php82, php83, php84 PUID: 1000 # default: 1000 diff --git a/rootfs/app/entrypoint.sh b/rootfs/app/entrypoint.sh index 883ef10..03e6498 100755 --- a/rootfs/app/entrypoint.sh +++ b/rootfs/app/entrypoint.sh @@ -17,13 +17,20 @@ chown "${PUID}:${GROUPNAME}" "${WEBROOT}" -R find "${WEBROOT}" -type d -exec chmod 0755 {} \; find "${WEBROOT}" -type f -exec chmod 0644 {} \; -envsubst < /app/nginx.conf.tpl > /etc/nginx/http.d/default.conf - # start php case "${PHP}" in - "php84") /usr/sbin/php-fpm84 -D ;; - "php83") /usr/sbin/php-fpm83 -D ;; - "php82") /usr/sbin/php-fpm82 -D ;; + "php84") + cp /app/nginx/php84.conf /etc/nginx/custom.d/ + /usr/sbin/php-fpm84 -D + ;; + "php83") + cp /app/nginx/php83.conf /etc/nginx/custom.d/ + /usr/sbin/php-fpm83 -D + ;; + "php82") + cp /app/nginx/php82.conf /etc/nginx/custom.d/ + /usr/sbin/php-fpm82 -D + ;; *) ;; esac diff --git a/rootfs/etc/nginx/custom.d/php82.conf b/rootfs/app/nginx/php82.conf similarity index 100% rename from rootfs/etc/nginx/custom.d/php82.conf rename to rootfs/app/nginx/php82.conf diff --git a/rootfs/etc/nginx/custom.d/php83.conf b/rootfs/app/nginx/php83.conf similarity index 100% rename from rootfs/etc/nginx/custom.d/php83.conf rename to rootfs/app/nginx/php83.conf diff --git a/rootfs/etc/nginx/custom.d/php84.conf b/rootfs/app/nginx/php84.conf similarity index 100% rename from rootfs/etc/nginx/custom.d/php84.conf rename to rootfs/app/nginx/php84.conf diff --git a/rootfs/etc/nginx/custom.d/none.conf b/rootfs/etc/nginx/custom.d/.placeholder similarity index 100% rename from rootfs/etc/nginx/custom.d/none.conf rename to rootfs/etc/nginx/custom.d/.placeholder diff --git a/rootfs/app/nginx.conf.tpl b/rootfs/etc/nginx/http.d/nginx.conf similarity index 90% rename from rootfs/app/nginx.conf.tpl rename to rootfs/etc/nginx/http.d/nginx.conf index d1f2ee4..70bc7ef 100644 --- a/rootfs/app/nginx.conf.tpl +++ b/rootfs/etc/nginx/http.d/nginx.conf @@ -18,10 +18,9 @@ server { # autoindex_localtime on; } - #error_page 404 /404.html; - + error_page 404 /404.html; location = /404.html { - internal; + internal; } # redirect server error pages to the static page /50x.html @@ -31,8 +30,6 @@ server { root /usr/share/nginx/html; } - include /etc/nginx/custom.d/${PHP}.conf; - gzip on; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js image/x-icon font/woff2 font/woff application/x-font-woff; @@ -43,4 +40,6 @@ server { if_modified_since exact; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public"; + + include /etc/nginx/custom.d/*.conf; }