Environment Variables
You don't need to replace the nginx configuration. With the byjg/php
image, you can adjust the NGINX configuration
and enable/disable modules. It fits for most users.
Any ENVIRONMENT variable can be accessible by your running PHP instance.
Change the Image Behavior
PHP_CONTROLLER=path
If set, will enable the PHP controller for the fpm-nginx
and fpm-apache
images, and
all requests will be directed to the PHP file specified.
docker run -e PHP_CONTROLLER=/app.php byjg/php:8.0-cli
NGINX_ROOT=path
Changes the server root. Defaults to /var/www/html
.
PHP_FPM_SERVER=server:port
If set, will enable the FastCGI pass to the PHP-FPM server. Defaults to 127.0.0.1:9000
.
PHP_FPM_IGNORE_ENV=true
If set, with any value, will ignore the system environment variables in the PHP FPM.
NGINX_SSL_CERT and NGINX_SSL_CERT_KEY
If set, will enable serving HTTPS pages.
docker run -v /etc/ssl:/etc/ssl \
-e NGINX_SSL_CERT=/etc/ssl/my.cert \
-e NGINX_SSL_CERT_KEY=/etc/ssl/my.key \
byjg/php:8.0-fpm-nginx
DISABLEMODULE_[name]=true
All modules are installed by default. You can disable a module when you start the instance:
docker run -e DISABLEMODULE_DOM=true -e DISABLEMODULE_XSL=true byjg/php:8.0-cli
VERBOSE=true
When you pass VERBOSE=true
, you can get a more verbose output about the entrypoint changes:
docker run -e VERBOSE=true byjg/php:8.0-cli