This guide refreshes common Apache and HTTP interview questions with modern, operations-focused answers. It is designed for DevOps engineers, SREs, and system administrators who need practical command knowledge, configuration context, and troubleshooting clarity.
Originally published on 2010-06-01; fully revised and updated.

How to use this interview guide
Use these answers as a baseline, then adapt to your distribution and Apache version. For exact directive behavior, verify with the Apache HTTP Server documentation used in your environment.
- Focus on what the command or directive does.
- Call out version differences (especially Apache 2.2 vs 2.4 syntax).
- Show safe operational workflow: test, reload, validate, rollback if needed.
Apache service control commands you should know
| Command | What it does | When to use |
|---|---|---|
systemctl stop httpd or systemctl stop apache2 | Stops Apache through systemd | Preferred on modern Linux systems using systemd |
apachectl stop | Stops Apache via control utility | Useful when using Apache-native tooling or non-systemd setups |
apachectl graceful | Reloads configuration with minimal connection disruption | Production config changes where you want continuity |
apachectl -t (or apachectl configtest) | Validates config syntax | Run before any reload/restart |
Interview tip: Mention that force-killing processes (for example, killall httpd) is usually a last resort because it bypasses normal service management.
# RHEL/CentOS/Fedora style
sudo systemctl status httpd
sudo systemctl stop httpd
# Debian/Ubuntu style
sudo systemctl status apache2
sudo systemctl stop apache2
# Validate config, then reload safely
sudo apachectl -t
sudo apachectl gracefulCode language: PHP (php)
Safe Apache configuration change workflow
flowchart LR
A[Edit Apache config] --> B[Run apachectl -t]
B --> C{Syntax valid}
C -- no --> D[Fix config]
D --> B
C -- yes --> E[Run graceful reload]
E --> F[Run health checks]
F --> G{Service healthy}
G -- no --> H[Rollback change]
G -- yes --> I[Change complete]
Apache process model: why root and non-root processes both appear
- Why one process runs as root: The parent process starts with elevated privileges so it can bind privileged ports such as 80 or 443.
- Why worker processes run unprivileged: Request handling is done by child/worker processes under a non-root account for security isolation.
- What happens if the parent dies: Worker lifecycle is controlled by the parent, so service availability is impacted until process supervision starts Apache again.
Configuration files: legacy vs modern layout
Questions about srm.conf and access.conf are historical. In very old Apache/NCSA-era layouts these existed separately, but modern deployments generally centralize configuration in a main file plus include directories.
| Item | Historical context | Modern interview-ready answer |
|---|---|---|
srm.conf and access.conf | Older split configuration files | Mostly legacy; current systems usually use one main config plus includes |
httpd.conf | Main Apache configuration file | Still commonly used, often with included files in conf.d, sites-available, and sites-enabled |
ServerType directive | Old standalone/inetd mode control | Considered legacy/deprecated in modern Apache operations discussions |
Virtual hosting in Apache
A virtual host maps hostname and request context to a specific site configuration. In interviews, explain ServerName, DocumentRoot, and dedicated logs per vhost.
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/example
ErrorLog /var/log/httpd/example-error.log
CustomLog /var/log/httpd/example-access.log combined
</VirtualHost>Code language: CSS (css)
mod_vhost_alias can simplify multi-tenant hosting by mapping hostnames to directory patterns (for example via VirtualDocumentRoot) rather than writing many repetitive virtual host blocks.
Authentication and authorization: htpasswd and access rules
htpasswd manages user credentials in a password file for Basic authentication. It does not create OS-level users or groups.
# Create a new password file and add user 'deployer'
sudo htpasswd -c /etc/httpd/.htpasswd deployerCode language: PHP (php)
<Directory "/var/www/private">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
</Directory>Code language: PHP (php)
Access control syntax: Apache 2.2 vs 2.4
| Task | Apache 2.2 style (legacy) | Apache 2.4 style (current) |
|---|---|---|
| Deny all access | Order allow,deny + Deny from all | Require all denied |
| Allow all access | Order deny,allow + Allow from all | Require all granted |
| Allow a subnet | Allow from 10.0.0.0/8 with matching Order | Require ip 10.0.0.0/8 |
| Rule precedence | Depends on the Order directive | Uses explicit Require authorization logic |
Core HTTP interview questions (quick answers)
- What is the difference between 301 and 302? 301 is permanent redirection; 302 is temporary redirection.
- What does HTTP 304 mean? Resource not modified, so cached content can be reused.
- Why is the Host header important? It enables name-based virtual hosting by identifying the target domain.
- Which methods are idempotent? GET, PUT, DELETE, HEAD, and OPTIONS are expected to be idempotent.
- What is keep-alive? Reusing a TCP connection for multiple HTTP requests to reduce connection overhead.
Troubleshooting commands interviewers expect you to know
# Show loaded modules
sudo apachectl -M
# Show active virtual host mapping
sudo apachectl -S
# Confirm Apache is listening on expected ports
sudo ss -ltnp | egrep ':80|:443'
# Inspect response headers quickly
curl -I http://127.0.0.1/
# Follow error logs (path varies by distribution)
sudo tail -f /var/log/httpd/error_logCode language: PHP (php)
Common pitfalls
- Using legacy 2.2 access-control syntax in 2.4 environments without validating compatibility.
- Reloading Apache before running
apachectl -t. - Assuming service names and log paths are identical across all Linux distributions.
- Using force-kill commands instead of controlled stop/reload procedures.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals