Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Apache and HTTP Interview Questions: Updated Answers for DevOps Engineers

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.

Apache and HTTP interview questions

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

CommandWhat it doesWhen to use
systemctl stop httpd or systemctl stop apache2Stops Apache through systemdPreferred on modern Linux systems using systemd
apachectl stopStops Apache via control utilityUseful when using Apache-native tooling or non-systemd setups
apachectl gracefulReloads configuration with minimal connection disruptionProduction config changes where you want continuity
apachectl -t (or apachectl configtest)Validates config syntaxRun 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.

ItemHistorical contextModern interview-ready answer
srm.conf and access.confOlder split configuration filesMostly legacy; current systems usually use one main config plus includes
httpd.confMain Apache configuration fileStill commonly used, often with included files in conf.d, sites-available, and sites-enabled
ServerType directiveOld standalone/inetd mode controlConsidered 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

TaskApache 2.2 style (legacy)Apache 2.4 style (current)
Deny all accessOrder allow,deny + Deny from allRequire all denied
Allow all accessOrder deny,allow + Allow from allRequire all granted
Allow a subnetAllow from 10.0.0.0/8 with matching OrderRequire ip 10.0.0.0/8
Rule precedenceDepends on the Order directiveUses 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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
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.

Related Posts

TFS Interview Questions and Answers: Practical DevOps Guide

A structured, interview-focused guide to Team Foundation Server (TFS), including TFVC vs Git, build and reporting topics, and practical command examples. Use it to prepare concise, technically strong answers for common TFS interview scenarios.

Read More

Chef Interview Q&A (Part 2): Resources, Run-Lists, Bootstrap, and Test Kitchen

A practical rewrite of classic Chef interview questions, focused on how Chef resources converge, how run-lists drive node configuration, and how to test cookbooks safely. Includes command examples, workflow diagrams, and comparison tables.

Read More

Chef Interview Questions, Explained: Resources, Run-Lists, Bootstrapping, and Test Kitchen

This updated guide converts classic Chef interview Q&A into a practical reference for real infrastructure work. It covers core concepts, execution order, bootstrap flow, key knife commands, and Test Kitchen testing patterns.

Read More

SVN Interview Questions and Answers: Trunk, Branch, Tag, Update, Commit, Patch, Backup, and Authentication

A practical, interview-focused guide to Subversion (SVN) concepts and commands. Learn how to explain trunk/branch/tag, update vs commit, conflict handling, patching, backup/restore, and auth setup with confidence.

Read More

Jenkins Interview Questions, Answered: CI, APIs, Installation, Backups, and Essential Plugins

This revised guide turns common Jenkins interview prompts into practical answers you can explain with confidence. It covers CI fundamentals, API usage, setup on Ubuntu and RHEL-like systems, backup strategy, and key plugins.

Read More

Git, GitHub, and GitLab Interview Questions: Practical Answers and Command Guide

A practical interview-prep guide covering core Git concepts, essential commands, and common GitHub/GitLab questions. Includes workflow diagrams, comparisons, and troubleshooting checklists.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x