Skip to main content

Environment Variables for Pi-hole

GitHub-logo.png

Variable Default Value Description
PIHOLE_DNS_ 8.8.8.8;8.8.4.4 Upstream DNS servers, separated by ;. Supports custom ports (e.g., 127.0.0.1#5053). DNS servers added via the web interface will be overwritten on restart.
DNSSEC false Enable DNSSEC support (true or false).
DNS_BOGUS_PRIV true Prevents forwarding reverse lookups for private ranges.
DNS_FQDN_REQUIRED true Prevents forwarding of non-FQDNs (Fully Qualified Domain Names).
REV_SERVER false Enables DNS conditional forwarding for local device name resolution.
REV_SERVER_DOMAIN unset Set the domain of the local network router if conditional forwarding is enabled.
REV_SERVER_TARGET unset IP of the local network router when conditional forwarding is enabled.
REV_SERVER_CIDR unset Reverse DNS zone (e.g., 192.168.0.0/24) for conditional forwarding.
DHCP_ACTIVE false Enable DHCP server (true or false).
DHCP_START unset Start IP for DHCP server (if DHCP is enabled).
DHCP_END unset End IP for DHCP server (if DHCP is enabled).
DHCP_ROUTER unset Router (gateway) IP for the DHCP server (if DHCP is enabled).
DHCP_LEASETIME 24 Lease time for DHCP (in hours).
PIHOLE_DOMAIN lan Domain name sent by the DHCP server.
DHCP_IPv6 false Enable DHCP IPv6 support (true or false).
DHCP_rapid_commit false Enable DHCPv4 rapid commit.
VIRTUAL_HOST ${HOSTNAME} Sets the virtual host for web access (e.g., http://pi.hole/admin).
IPv6 true Disables IPv6 configuration when set to false (helpful for Unraid).
TEMPERATUREUNIT c Sets temperature unit (c: Celsius, k: Kelvin, or f: Fahrenheit).
WEBUIBOXEDLAYOUT boxed Use boxed or traditional layout for the web interface.
QUERY_LOGGING true Enables or disables query logging.
WEBTHEME default-light User interface theme (options: default-dark, default-light, default-auto, etc.).
WEBPASSWORD_FILE unset Set admin password via Docker secrets. Ignored if WEBPASSWORD is set.

Advanced Variables

Variable Default Value Description
INTERFACE unset NIC interface for DNS or DHCP services.
DNSMASQ_LISTENING unset Listening behavior (local, all, single).
WEB_PORT unset Custom web interface port (may affect the "blocked" page functionality).
WEB_BIND_ADDR unset Bind address for the web interface.
SKIPGRAVITYONBOOT unset Skip updating Gravity Database on boot (set to 1 to skip).
CORS_HOSTS unset List of FQDNs allowed for CORS (comma-separated).
CUSTOM_CACHE_SIZE 10000 Sets cache size for dnsmasq. Ignored if DNSSEC is enabled.
FTL_CMD no-daemon Customize dnsmasq options (e.g., no-daemon -- --dns-forward-max 300).
FTLCONF_[SETTING] unset Customize pihole-FTL.conf settings (e.g., FTLCONF_LOCAL_IPV4).

Experimental Variables

Variable Default Value Description
DNSMASQ_USER unset Change the user that FTLDNS runs as (pihole or root).
PIHOLE_UID 999 Override Pi-hole's default user ID.
PIHOLE_GID 999 Override Pi-hole's default group ID.
WEB_UID 33 Override the www-data user ID.
WEB_GID 33 Override the www-data group ID.
WEBLOGS_STDOUT 0 Redirects web logs to stdout when set to 1.