MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

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

Top 50 Apache HTTPD Interview questions and answers

1) What do you mean by Apache Web Server? Apache web server is the HTTP web server that is open source, and it is used for hosting…

Read More

How to save HTTP requests headers, methods and body to a file?

Method 1 – Using mod_log_forensic apache Module Step 1 – Check if mod_log_forensic module is enabled or not Step 2 – Enable mod_log_forensic module using following lines…

Read More

Apache: Comprehensive list of Apache HTTP Server configuration directives

This page lists the Apache HTTP Server 2.4 configuration directives you will see most often in httpd.conf, virtual host files and SSL configs, grouped by function. Below…

Read More

Install and Configure Gerrit on CentOS and Ubuntu (MySQL + Apache Reverse Proxy)

A practical, step-by-step guide to installing Gerrit for code review on CentOS/RHEL and Ubuntu/Debian. Includes package command comparisons, setup workflow, Apache proxy configuration, and verification checks.

Read More

HTTP 404 for DevOps: Root-Cause, Routing, and Prevention Across Edge, Ingress, and App Layers

HTTP 404 errors are simple for users but often complex in distributed systems. This guide shows DevOps teams how to locate the failing layer, apply the right fix, and prevent repeat incidents.

Read More

Jenkins Command-Line Authentication and Job Triggers with cURL and Wget

Learn practical ways to authenticate scripted requests to Jenkins and trigger jobs from the command line using cURL and wget. This revision also covers CSRF crumb handling, version caveats, and troubleshooting.

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
30 days ago

Understanding both Apache and HTTP concepts helps build a strong foundation for web server troubleshooting. It is useful to know how requests move from clients to servers and how status codes explain common failures. Practicing virtual host setup, HTTPS configuration, and log analysis can strengthen practical skills. Security basics, such as correct permissions and timely updates, are equally important. Combining theory with real troubleshooting examples makes interview preparation more effective.

1
0
Would love your thoughts, please comment.x
()
x