Fix Docker PHP-FPM config for Coolify

This commit is contained in:
z0rayy
2026-06-10 17:49:34 +07:00
parent 094329369e
commit 0130dd70dd
+10 -5
View File
@@ -12,9 +12,12 @@ RUN apk add --no-cache nginx \
# CRITICAL: Allow ENV vars from Coolify (DB_HOST, DB_PASS, etc.) # CRITICAL: Allow ENV vars from Coolify (DB_HOST, DB_PASS, etc.)
# to be readable via getenv() in PHP. PHP-FPM strips env vars by default. # to be readable via getenv() in PHP. PHP-FPM strips env vars by default.
RUN echo "" >> /usr/local/etc/php-fpm.d/www.conf \ RUN set -eux; \
&& echo "[www]" >> /usr/local/etc/php-fpm.d/www.conf \ if grep -qE '^[;[:space:]]*clear_env[[:space:]]*=' /usr/local/etc/php-fpm.d/www.conf; then \
&& echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf sed -i 's/^[;[:space:]]*clear_env[[:space:]]*=.*/clear_env = no/' /usr/local/etc/php-fpm.d/www.conf; \
else \
printf '\nclear_env = no\n' >> /usr/local/etc/php-fpm.d/www.conf; \
fi
# Copy Nginx configuration # Copy Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
@@ -23,9 +26,11 @@ COPY nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /run/nginx && \ RUN mkdir -p /run/nginx && \
mkdir -p /var/log/nginx mkdir -p /var/log/nginx
# Copy entrypoint script and make executable # Copy entrypoint script
# Fix Windows CRLF line endings (caused by git autocrlf) then make executable
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN sed -i 's/\r$//' /entrypoint.sh \
&& chmod +x /entrypoint.sh
# Set working directory # Set working directory
WORKDIR /var/www/html WORKDIR /var/www/html