Apache uses a main configuration file in a plain text format which normally then calls other files using Include and IncludeOptional directives for ease of management and separation of concern.

The location of Apache's main configuration file is set during compile time and differ between distributions.

Distribution Location
apache.org source package/usr/local/apache2/conf/httpd.conf
Debian, Ubuntu /etc/apache2/apache2.conf
Fedora Core, CentOS, RHEL /etc/httpd/conf/httpd.conf
macOS /private/etc/apache2/httpd.conf
Windows“C:/Program Files/Apache Software Foundation/Apache2.4/conf/httpd.conf”
openSUSE and SLES/etc/apache2/httpd.conf
homebrew /usr/local/etc/apache2/2.4/httpd.conf
xampp {installation directory}/apache/conf/httpd.conf

You can always check the location of the configuration file by running the Apache binary for your distribution with the -V option and then look for the SERVER_CONFIG_FILE value.

$ apachectl -V
Server version: Apache/2.4.41 (Unix)
Server built:   Nov  9 2019 07:53:54
Server's Module Magic Number: 20120211:88
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_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -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"

Combine the output for both HTTPD_ROOT and SERVER_CONFIG_FILE If the output doesn't provide absolute full path of the configuration file.

Default Apache configuration

Apart from using different location for the main configuration file, different distributions also use different options for Apache which could get a bit confusing.

The table below lists some of the default configuration values for Apache on different distributions.

Distribution apache.org source package Debian, Ubuntu Fedora Core, CentOS, RHEL macOS Windows openSUSE and SLES
ServerRoot /usr/local/apache2 /etc/apache2 /etc/httpd /usr “C:/Program Files/Apache Software Foundation/Apache2.4” /srv/www
Primary config file /usr/local/apache2/conf/httpd.conf /etc/apache2/apache2.conf /etc/httpd/conf/httpd.conf /private/etc/apache2/httpd.conf “C:/Program Files/Apache Software Foundation/Apache2.4/conf/httpd.conf” /etc/apache2/httpd.conf
DocumentRoot /usr/local/apache2/htdocs /var/www/html /var/www/html /Library/WebServer/Documents “C:/Program Files/Apache Software Foundation/Apache2.4/htdocs” /srv/www/htdocs
Default VHost Config /etc/apache2/sites-available/000-default /private/etc/apache2/vhosts/ /etc/apache2/vhosts.d/
Module Locations /usr/lib/apache2/modules/ /etc/httpd/modules /usr/libexec/apache2/ usr/lib64/apache2-prefork/
ErrorLog /usr/local/apache2/logs/error_log /var/log/apache2/error.log /var/log/httpd/error_log /privatevar/log/apache2/error_log |“C:/Program Files/Apache Software Foundation/Apache2.4/logs/error.log” |/var/log/apache2/error_log | |AccessLog |/usr/local/apache2/logs/access_log |/var/log/apache2/access.log |/var/log/httpd/access_log |/privatevar/log/apache2/access_log “C:/Program Files/Apache Software Foundation/Apache2.4/logs/access.log” /var/log/apache2/access_log
cgi-bin /usr/local/apache2/cgi-bin (enabled by default, but some of the bundled scripts are 644) /usr/lib/cgi-bin /var/www/cgi-bin (empty and disabled by default) /Library/WebServer/CGI-Executables (empty by default) “C:/Program Files/Apache Software Foundation/Apache2.4/cgi-bin/” /srv/www/cgi-bin
binaries /usr/local/apache2/bin/apachectl /usr/sbin/apachectl /usr/sbin/httpd /usr/sbin/httpd “C:/Program Files/Apache Software Foundation/Apache2.4/bin/apachectl” /usr/sbin/apachectl
User www-data apache _www wwwrun
Group www-data apache _www www
Discuss the article:

Comment anonymously. Login not required.