support for extra host config
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paolo Asperti 2024-12-15 10:59:53 +01:00
parent bc8f5967c4
commit dfc8640b17
Signed by: paspo
GPG Key ID: 06D46905D19D5182
8 changed files with 18 additions and 11 deletions

View File

@ -2,7 +2,7 @@ FROM alpine:3.21
RUN \ RUN \
apk -U upgrade && \ 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 / COPY rootfs /

View File

@ -18,6 +18,7 @@ services:
volumes: volumes:
- ./www:/data/www - ./www:/data/www
- ./ssh:/ssh # add authorized_keys file here - ./ssh:/ssh # add authorized_keys file here
- ./extra_nginx.conf:/etc/nginx/custom.d/extra.conf # optional
environment: environment:
PHP: php84 # none (default), php82, php83, php84 PHP: php84 # none (default), php82, php83, php84
PUID: 1000 # default: 1000 PUID: 1000 # default: 1000

View File

@ -17,13 +17,20 @@ chown "${PUID}:${GROUPNAME}" "${WEBROOT}" -R
find "${WEBROOT}" -type d -exec chmod 0755 {} \; find "${WEBROOT}" -type d -exec chmod 0755 {} \;
find "${WEBROOT}" -type f -exec chmod 0644 {} \; find "${WEBROOT}" -type f -exec chmod 0644 {} \;
envsubst < /app/nginx.conf.tpl > /etc/nginx/http.d/default.conf
# start php # start php
case "${PHP}" in case "${PHP}" in
"php84") /usr/sbin/php-fpm84 -D ;; "php84")
"php83") /usr/sbin/php-fpm83 -D ;; cp /app/nginx/php84.conf /etc/nginx/custom.d/
"php82") /usr/sbin/php-fpm82 -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 esac

View File

@ -18,8 +18,7 @@ server {
# autoindex_localtime on; # autoindex_localtime on;
} }
#error_page 404 /404.html; error_page 404 /404.html;
location = /404.html { location = /404.html {
internal; internal;
} }
@ -31,8 +30,6 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
} }
include /etc/nginx/custom.d/${PHP}.conf;
gzip on; gzip on;
gzip_proxied any; 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; 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; if_modified_since exact;
add_header Pragma "public"; add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public"; add_header Cache-Control "max-age=31536000, public";
include /etc/nginx/custom.d/*.conf;
} }