Apache · Configuration and operations

How is Apache installed and laid out on common Linux distributions?

EasyinstallationlinuxfilesystemUpdated Oct 2026
Quiz this track

Short answer

Apache is installed from the distribution package manager. Debian and Ubuntu use /etc/apache2 with sites-available and mods-available, while RHEL-family systems use /etc/httpd with conf.d and conf.modules.d.

The package installs the binaries, default configuration, an unprivileged runtime user and a service unit. Knowing the layout matters because the same logical directive lives in different files depending on the distribution.

bash
sudo apt update
sudo apt install apache2
apache2ctl -V
apache2ctl -M
systemctl status apache2

sudo dnf install httpd
httpd -V
systemctl enable --now httpd

Debian and Ubuntu

  • /etc/apache2/apache2.conf: main configuration
  • /etc/apache2/ports.conf: Listen directives
  • /etc/apache2/sites-available and sites-enabled: virtual hosts
  • /etc/apache2/mods-available and mods-enabled: loadable modules
  • /etc/apache2/conf-available and conf-enabled: shared snippets
  • a2ensite, a2dissite, a2enmod and a2dismod manage the symlinks

RHEL, CentOS and Fedora

  • /etc/httpd/conf/httpd.conf: main configuration
  • /etc/httpd/conf.d: drop-in configuration
  • /etc/httpd/conf.modules.d: module loading
  • /var/www/html: default document root
  • systemctl reload httpd applies a validated configuration
Do not edit files under sites-enabled or mods-enabled directly on Debian. They are symlinks; edit the file in the available directory and re-enable or reload.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1Where would you put a new virtual host on Ubuntu?
  2. 2How do you check which modules are loaded?
  3. 3What is the difference between the available and enabled directories?
  4. 4Where are Apache logs on each distribution?

Say it in the interview

On Debian and Ubuntu I work under /etc/apache2, using sites-available and sites-enabled plus a2ensite and a2enmod. On RHEL-family systems the layout is /etc/httpd with conf.d and conf.modules.d. The binaries and service names differ too, apache2 versus httpd. I always confirm the real layout with apachectl -V instead of assuming.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Apache mock interview and get scored feedback on depth, clarity and confidence.