Since the recent upgrade to gidblog.com, this web site is currently being hosted by various Docker containers. One of the Docker containers used is, of course, one derived from a Docker image like php:7-fpm-alpine.
One of the areas I got stuck for a while (making this site work with PHP-FPM) is that PHP scripts — in this case generated web pages — were not sending gz-encoded data (compressed web pages) back to web browsers.
I also know how to make individual PHP scripts turn output compression on.
Actually, reading that last link/page gave me the solution I was looking for – use the
zlib.output_compression php.ini setting when creating my PHP-FPM Docker image.
So this was how my Dockerfile for the PHP-FPM/Alpine Linux image looks like with this setting all set up. See the last line:
FROM php:7-fpm-alpine RUN apk update; apk upgrade; RUN docker-php-ext-install mysqli RUN docker-php-ext-install opcache # Other instructions removed for brevity # # PHP.INI RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" # zlib compression RUN echo "zlib.output_compression = On" >> "$PHP_INI_DIR/php.ini"
As soon as this Docker image was built again and running, all web pages generated by PHP-FPM for this web site are being compressed before being sent out to web browsers and clients that accept the encoding.