Apache configuration files
Apache‘s main configuration file by default. It will then call out other files and directories via
IncludeOptional directives which is meant to simplify the main configuration file, and the structure wildly varies between platforms.
httpd.conf itself is located differently between platforms. These are some of the known locations;
If your platform of choice is not on the list, simply run
httpd -V from the terminal and look for
# httpd -V Server version: Apache/2.4.25 (Unix) Server built: Feb 6 2017 20:02:10 Server's Module Magic Number: 20120211:67 Server loaded: APR 1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FLOCK_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/bin/suexec" -D DEFAULT_PIDLOG="/private/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types" -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
Different platform might use different binary names such as
grep to get only the relevant line.
# httpd -V | grep SERVER_CONFIG_FILE -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
Combine the output for both
SERVER_CONFIG_FILE If the output doesn’t provide absolute full path of the configuration file.