Where Are the Apache Config Files?
Debian and Red Hat layouts put Apache's main config in different places, so identifying your layout comes before editing anything.
Last updated
Apache has two directory layouts and no reliable way to guess yours except looking. Debian and Ubuntu center on /etc/apache2 with an apache2.conf that includes the rest. RHEL, CentOS, and Fedora use /etc/httpd with httpd.conf instead.
Virtual hosts follow the split too: sites-available plus a2ensite on Debian, plain conf.d drop-ins on RHEL. Run apachectl configtest after edits. It reports syntax errors without restarting the live server.
Where Apache stores this, by platform
/etc/apache2/apache2.conf
Debian/Ubuntu layout. On RHEL style systems use /etc/httpd/conf/httpd.conf instead. Virtual hosts go in sites-available (Debian) or conf.d (RHEL).
C:\Apache24\conf\httpd.conf
Default for Apache Lounge and similar builds. The ServerRoot line near the top defines where the server expects its sibling folders.
Frequently asked questions
Where do I put a new virtual host?
Debian: a file in sites-available, enabled with a2ensite. RHEL: a .conf file in conf.d. Both need a configtest and a graceful restart before the host answers.
Should settings go in httpd.conf or .htaccess?
Prefer the main config. .htaccess only applies when AllowOverride permits it, and Apache re-reads those files per request, which costs performance the main config avoids.
Notice an outdated path? Let us know.