Apache configuration files
httpd.conf
is Apache
‘s main configuration file by default. It will then call out other files and directories via Include
and 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;
Platform | Location |
---|---|
xampp | {installation directory}/apache/conf/httpd.conf |
macOS | /private/etc/apache2/httpd.conf |
homebrew | /usr/local/etc/apache2/2.4/httpd.conf |
Debian/Ubuntu | /etc/apache2/httpd.conf |
RedHat/CentOS/Fedora | /etc/httpd/conf/httpd.conf |
If your platform of choice is not on the list, simply run httpd -V
from the terminal and look for SERVER_CONFIG_FILE
.
# 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 apache
, apache2
, apachectl
or apache2ctl
Use 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 HTTPD_ROOT
and SERVER_CONFIG_FILE
If the output doesn’t provide absolute full path of the configuration file.