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.
$ 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.
$ 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.
$ 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.
$ 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.
$ 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.
$ 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/.
$ 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.
$ sudo apache2ctl configtest Syntax OK
Use sudo httpd -t or sudo apachectl -t on systems that do not ship the apache2ctl wrapper.
Related: How to test Apache configuration
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 style | ServerRoot | Main configuration file | Common module or drop-in files | Common 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.conf | Any files you add with Include or IncludeOptional | Often /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.
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 style | Control wrapper | Server binary | Service name | Common DocumentRoot | Common worker user / group |
|---|---|---|---|---|---|
| Debian and Ubuntu packages | apache2ctl | apache2 | apache2.service | /var/www/html | www-data / www-data |
| RHEL-style packages | apachectl or httpd | httpd | httpd.service | /var/www/html | apache / apache |
| Homebrew httpd on Apple Silicon | apachectl or httpd | httpd | brew services httpd | /opt/homebrew/var/www | _www / _www |
| Upstream source-build default | apachectl | httpd | depends on your service manager | /usr/local/apache2/htdocs unless DocumentRoot was changed | Defined 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.