Skip to main content

đŸ—„ī¸ Environment Variables

Full reference for every setting exposed by ruseler/alpine-php-webserver. Defaults come from the Dockerfile and are applied unless you override them.

Nginx​

VariableDefaultPurpose
nginx_root_directory/var/www/htmlDocument root for the default server block.
client_max_body_size2MMax allowed request body size. Raise for uploads.
fastcgi_read_timeout60sMax time waiting for a response from PHP-FPM.
fastcgi_send_timeout60sMax time transmitting a request to PHP-FPM.
DISABLE_DEFAULT_LOCATIONfalseComment out the built-in location / { ... } block so you can provide your own via /etc/nginx/server-conf.d/. See #43.

Trusted proxy / real IP​

Real IP restoration is disabled by default. Configure REAL_IP_FROM with a strict allow-list of trusted proxies to enable it.

VariableDefaultPurpose
REAL_IP_HEADERX-Forwarded-ForHeader Nginx reads as the client IP (X-Forwarded-For, CF-Connecting-IP, X-Real-IPâ€Ļ).
REAL_IP_RECURSIVEoffon = walk the trusted chain recursively.
REAL_IP_FROM(empty)Comma-separated list of trusted proxy IPs / CIDRs. Real IP stays disabled until this is set.

See Reverse Proxy & Trusted IPs for concrete recipes.

Never use broad public ranges

REAL_IP_FROM=0.0.0.0/0 would let any client spoof the configured header. Trust only proxies you control (internal CIDRs, Cloudflare's published ranges, your tunnel connector, etc.).

PHP runtime​

VariableDefaultPurpose
clear_envnoKeep env vars available to FPM workers.
allow_url_fopenOnURL-aware fopen().
allow_url_includeOffURL-aware include() / require(). Leave off.
display_errorsOffRender errors in HTTP responses.
file_uploadsOnEnable HTTP uploads.
max_execution_time0Max seconds per script. 0 = unlimited.
max_input_time-1Max seconds parsing input. -1 = unlimited.
max_input_vars1000Max input vars per request.
memory_limit128MPer-request memory ceiling.
post_max_size8MMax POST body. Must exceed upload_max_filesize.
upload_max_filesize2MMax single file upload.
zlib_output_compressionOnTransparent output compression.
date_timezoneUTCPHP date.timezone.
intl_default_localeen_USPHP intl.default_locale.

OPcache​

VariableDefaultPurpose
opcache_enable01 to enable OPcache.
opcache_memory_consumption256Shared memory in MB.
opcache_max_accelerated_files20000Max cached files.
opcache_validate_timestamps01 revalidates on every request (dev); 0 never (prod).
opcache_preload(empty)Preload script path.
realpath_cache_size4096KRealpath cache size.
realpath_cache_ttl600Realpath cache TTL (seconds).

See PHP Configuration for usage notes and examples.

Adding your own variables​

Anything not in this table can be injected via:

  • /etc/nginx/conf.d/*.conf or /etc/nginx/server-conf.d/*.conf for Nginx directives
  • /etc/php84/conf.d/NN-*.ini for PHP settings
  • A custom image extending this one

See Extending the Image.


This documentation is a fork of erseco/alpine-php-webserver. The upstream documentation is available here.