Finding the active Apache configuration files before you edit anything keeps routine changes from landing in the wrong place. That matters when you need to change a virtual host, disable a module, or debug a directive that looks correct on disk but is still ignored by the running server.

Apache reads one main configuration file, then loads more files through Include and IncludeOptional directives. The fastest way to find the real paths is to ask the installed server which ServerRoot and main configuration file it was built with, then dump the include chain and virtual host map from that same build.

The steps below use the Debian and Ubuntu package layout where apache2ctl reports settings under /etc/apache2. RHEL-style packages use the httpd binary and the /etc/httpd tree instead, and openSUSE or SLES split defaults across files under /etc/apache2. Some commands also need sudo so Apache can read every included file and print the full run-time configuration.

Steps to locate Apache configuration files:

  1. Print the compiled Apache paths from the platform wrapper.
    $ apache2ctl -V
    Server version: Apache/2.4.58 (Ubuntu)
    Server built:   2026-03-05T17:31:54
    ##### snipped #####
     -D HTTPD_ROOT="/etc/apache2"
     -D SERVER_CONFIG_FILE="apache2.conf"

    On RHEL, Rocky Linux, AlmaLinux, CentOS Stream, and Fedora, use httpd -V or apachectl -V and expect HTTPD_ROOT to resolve under /etc/httpd.

  2. Combine HTTPD_ROOT and SERVER_CONFIG_FILE when SERVER_CONFIG_FILE is relative.
    $ apache2ctl -V | grep -E 'HTTPD_ROOT|SERVER_CONFIG_FILE'
     -D HTTPD_ROOT="/etc/apache2"
     -D SERVER_CONFIG_FILE="apache2.conf"

    That pair resolves to /etc/apache2/apache2.conf on a default Ubuntu or Debian install, and to /etc/httpd/conf/httpd.conf on current RHEL-style packages.

  3. Dump the full include chain so you can see which module, site, and drop-in files are actually loaded.
    $ sudo apache2ctl -t -D DUMP_INCLUDES
    Included configuration files:
      (*) /etc/apache2/apache2.conf
        (146) /etc/apache2/mods-enabled/access_compat.load
        (150) /etc/apache2/ports.conf
        (222) /etc/apache2/conf-enabled/security.conf
        (225) /etc/apache2/sites-enabled/000-default.conf
    ##### snipped #####

    IncludeOptional entries appear only when the wildcard matches one or more files. If your build does not support DUMP_INCLUDES, inspect the main configuration file for Include and IncludeOptional directives instead.

  4. Dump the run-time configuration to confirm the active ServerRoot, main DocumentRoot, log path, and worker account.
    $ sudo apache2ctl -t -D DUMP_RUN_CFG
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    PidFile: "/var/run/apache2/apache2.pid"
    User: name="www-data" id=33
    Group: name="www-data" id=33

    Use this output to distinguish packaged defaults from values later overridden in a site file or drop-in.

  5. Dump the active virtual host map to identify which file defines each site.
    $ sudo apache2ctl -S
    VirtualHost configuration:
    *:80                   host.example.net (/etc/apache2/sites-enabled/000-default.conf:1)
    ##### snipped #####
    ServerRoot: "/etc/apache2"

    The file and line number next to each host is usually the fastest path to the right VirtualHost block.

  6. Inspect the enabled configuration directories when you need the source file behind a split package layout.
    $ ls -l /etc/apache2/mods-enabled /etc/apache2/conf-enabled /etc/apache2/sites-enabled
    /etc/apache2/conf-enabled:
    total 0
    lrwxrwxrwx 1 root root 30 Mar 21 10:15 security.conf -> ../conf-available/security.conf
    
    /etc/apache2/sites-enabled:
    total 0
    lrwxrwxrwx 1 root root 35 Mar 21 10:15 000-default.conf -> ../sites-available/000-default.conf
    ##### snipped #####

    On Debian and Ubuntu, edit the matching file in /etc/apache2/*-available/ rather than the symlink under /etc/apache2/*-enabled/.

  7. Search inside the loaded tree when you know the directive name but not the file that sets it.
    $ sudo grep -RIn --include='*.conf' '^[[:space:]]*DocumentRoot' /etc/apache2
    /etc/apache2/sites-available/000-default.conf:12:	DocumentRoot /var/www/html

    Search the tree reported by HTTPD_ROOT so the result stays aligned with the running build instead of a guessed path.

  8. Test the configuration after editing the file you identified.
    $ sudo apache2ctl configtest
    Syntax OK

    Use sudo httpd -t or sudo apachectl -t on systems that do not ship the apache2ctl wrapper.

Default Apache configuration location

The running server is always the final source of truth, but these layouts are the common starting points when you need to inspect the filesystem before you can query the active process directly.

Packaging styleServerRootMain configuration fileCommon module or drop-in filesCommon virtual host location
Debian and Ubuntu packages/etc/apache2/etc/apache2/apache2.conf/etc/apache2/mods-enabled/*.load and *.conf
/etc/apache2/conf-enabled/*.conf
/etc/apache2/ports.conf
/etc/apache2/sites-enabled/*.conf (usually symlinks to /etc/apache2/sites-available/)
RHEL-style packages (RHEL, Rocky, AlmaLinux, CentOS Stream, Fedora)/etc/httpd/etc/httpd/conf/httpd.conf/etc/httpd/conf.modules.d/*.conf
/etc/httpd/conf.d/*.conf
Usually /etc/httpd/conf.d/*.conf
openSUSE and SLES packages/srv/www/etc/apache2/httpd.conf/etc/apache2/loadmodule.conf
/etc/apache2/conf.d/*.conf
/etc/apache2/default-server.conf
/etc/apache2/vhosts.d/*.conf
Homebrew httpd on Apple Silicon/opt/homebrew/opt/httpd/opt/homebrew/etc/httpd/httpd.conf/opt/homebrew/etc/httpd/extra/*.conf
/opt/homebrew/etc/httpd/other/*.conf
/opt/homebrew/etc/httpd/extra/httpd-vhosts.conf when enabled, or files under /opt/homebrew/etc/httpd/other/*.conf
Upstream source-build default/usr/local/apache2/usr/local/apache2/conf/httpd.confAny files you add with Include or IncludeOptionalOften /usr/local/apache2/conf/extra/*.conf, or VirtualHost blocks kept directly in httpd.conf

On Intel macOS systems, the common Homebrew prefix is /usr/local/ instead of /opt/homebrew/. Use brew --prefix httpd or httpd -V on the host to confirm the real prefix before editing files.

Default Apache configuration value

Run apache2ctl -t -D DUMP_RUN_CFG, httpd -t -D DUMP_RUN_CFG, or the equivalent platform wrapper to confirm the actual run-time values on your host. These are the common packaged defaults that help interpret the output.

Packaging styleControl wrapperServer binaryService nameCommon DocumentRootCommon worker user / group
Debian and Ubuntu packagesapache2ctlapache2apache2.service/var/www/htmlwww-data / www-data
RHEL-style packagesapachectl or httpdhttpdhttpd.service/var/www/htmlapache / apache
Homebrew httpd on Apple Siliconapachectl or httpdhttpdbrew services httpd/opt/homebrew/var/www_www / _www
Upstream source-build defaultapachectlhttpddepends on your service manager/usr/local/apache2/htdocs unless DocumentRoot was changedDefined in httpd.conf or your local packaging

openSUSE and SLES split several defaults across /etc/apache2/uid.conf, /etc/apache2/default-server.conf, and /etc/apache2/vhosts.d/, so checking the live run-time dump is more reliable than assuming one file contains every default.