{"id":258,"date":"2026-10-13T04:11:34","date_gmt":"2026-10-13T04:11:34","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/06\/01\/apache-and-http-interview-questions\/"},"modified":"2026-10-13T04:11:34","modified_gmt":"2026-10-13T04:11:34","slug":"apache-and-http-interview-questions","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/apache-and-http-interview-questions\/","title":{"rendered":"Apache and HTTP Interview Questions: Updated Answers for DevOps Engineers"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Originally published on 2010-06-01; fully revised and updated.<\/em><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/06\/apache-and-http-interview-q.png\" alt=\"Apache and HTTP interview questions\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">How to use this interview guide<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use these answers as a baseline, then adapt to your distribution and Apache version. For exact directive behavior, verify with the <a href=\"https:\/\/httpd.apache.org\/docs\/\">Apache HTTP Server documentation<\/a> used in your environment.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Focus on <strong>what the command or directive does<\/strong>.<\/li><li>Call out <strong>version differences<\/strong> (especially Apache 2.2 vs 2.4 syntax).<\/li><li>Show <strong>safe operational workflow<\/strong>: test, reload, validate, rollback if needed.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Apache service control commands you should know<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>What it does<\/th><th>When to use<\/th><\/tr><\/thead><tbody><tr><td><code>systemctl stop httpd<\/code> or <code>systemctl stop apache2<\/code><\/td><td>Stops Apache through systemd<\/td><td>Preferred on modern Linux systems using systemd<\/td><\/tr><tr><td><code>apachectl stop<\/code><\/td><td>Stops Apache via control utility<\/td><td>Useful when using Apache-native tooling or non-systemd setups<\/td><\/tr><tr><td><code>apachectl graceful<\/code><\/td><td>Reloads configuration with minimal connection disruption<\/td><td>Production config changes where you want continuity<\/td><\/tr><tr><td><code>apachectl -t<\/code> (or <code>apachectl configtest<\/code>)<\/td><td>Validates config syntax<\/td><td>Run before any reload\/restart<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Interview tip:<\/strong> Mention that force-killing processes (for example, <code>killall httpd<\/code>) is usually a last resort because it bypasses normal service management.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># RHEL\/CentOS\/Fedora style<\/span>\nsudo systemctl status httpd\nsudo systemctl stop httpd\n\n<span class=\"hljs-comment\"># Debian\/Ubuntu style<\/span>\nsudo systemctl status apache2\nsudo systemctl stop apache2\n\n<span class=\"hljs-comment\"># Validate config, then reload safely<\/span>\nsudo apachectl -t\nsudo apachectl graceful<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Safe Apache configuration change workflow<\/h2>\n\n\n\n<pre class=\"mermaid\">\nflowchart LR\n    A[Edit Apache config] --> B[Run apachectl -t]\n    B --> C{Syntax valid}\n    C -- no --> D[Fix config]\n    D --> B\n    C -- yes --> E[Run graceful reload]\n    E --> F[Run health checks]\n    F --> G{Service healthy}\n    G -- no --> H[Rollback change]\n    G -- yes --> I[Change complete]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Apache process model: why root and non-root processes both appear<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Why one process runs as root:<\/strong> The parent process starts with elevated privileges so it can bind privileged ports such as 80 or 443.<\/li><li><strong>Why worker processes run unprivileged:<\/strong> Request handling is done by child\/worker processes under a non-root account for security isolation.<\/li><li><strong>What happens if the parent dies:<\/strong> Worker lifecycle is controlled by the parent, so service availability is impacted until process supervision starts Apache again.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Configuration files: legacy vs modern layout<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Questions about <code>srm.conf<\/code> and <code>access.conf<\/code> 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.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Item<\/th><th>Historical context<\/th><th>Modern interview-ready answer<\/th><\/tr><\/thead><tbody><tr><td><code>srm.conf<\/code> and <code>access.conf<\/code><\/td><td>Older split configuration files<\/td><td>Mostly legacy; current systems usually use one main config plus includes<\/td><\/tr><tr><td><code>httpd.conf<\/code><\/td><td>Main Apache configuration file<\/td><td>Still commonly used, often with included files in <code>conf.d<\/code>, <code>sites-available<\/code>, and <code>sites-enabled<\/code><\/td><\/tr><tr><td><code>ServerType<\/code> directive<\/td><td>Old standalone\/inetd mode control<\/td><td>Considered legacy\/deprecated in modern Apache operations discussions<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Virtual hosting in Apache<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A virtual host maps hostname and request context to a specific site configuration. In interviews, explain <strong>ServerName<\/strong>, <strong>DocumentRoot<\/strong>, and dedicated logs per vhost.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css language-apache\">&lt;<span class=\"hljs-selector-tag\">VirtualHost<\/span> *<span class=\"hljs-selector-pseudo\">:80<\/span>&gt;\n    <span class=\"hljs-selector-tag\">ServerName<\/span> <span class=\"hljs-selector-tag\">www<\/span><span class=\"hljs-selector-class\">.example<\/span><span class=\"hljs-selector-class\">.com<\/span>\n    <span class=\"hljs-selector-tag\">ServerAdmin<\/span> <span class=\"hljs-selector-tag\">admin<\/span><span class=\"hljs-keyword\">@example<\/span>.com\n    DocumentRoot \/var\/www\/example\n    ErrorLog \/var\/log\/httpd\/example-error.log\n    CustomLog \/var\/log\/httpd\/example-access.log combined\n&lt;\/VirtualHost&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><code>mod_vhost_alias<\/code> can simplify multi-tenant hosting by mapping hostnames to directory patterns (for example via <code>VirtualDocumentRoot<\/code>) rather than writing many repetitive virtual host blocks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication and authorization: htpasswd and access rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>htpasswd<\/code> manages user credentials in a password file for Basic authentication. It does <strong>not<\/strong> create OS-level users or groups.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Create a new password file and add user 'deployer'<\/span>\nsudo htpasswd -c \/etc\/httpd\/.htpasswd deployer<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-apache\">&lt;Directory <span class=\"hljs-string\">\"\/var\/www\/private\"<\/span>&gt;\n    AuthType Basic\n    AuthName <span class=\"hljs-string\">\"Restricted Content\"<\/span>\n    AuthUserFile \/etc\/httpd\/.htpasswd\n    <span class=\"hljs-keyword\">Require<\/span> valid-user\n&lt;\/Directory&gt;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Access control syntax: Apache 2.2 vs 2.4<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Task<\/th><th>Apache 2.2 style (legacy)<\/th><th>Apache 2.4 style (current)<\/th><\/tr><\/thead><tbody><tr><td>Deny all access<\/td><td><code>Order allow,deny<\/code> + <code>Deny from all<\/code><\/td><td><code>Require all denied<\/code><\/td><\/tr><tr><td>Allow all access<\/td><td><code>Order deny,allow<\/code> + <code>Allow from all<\/code><\/td><td><code>Require all granted<\/code><\/td><\/tr><tr><td>Allow a subnet<\/td><td><code>Allow from 10.0.0.0\/8<\/code> with matching <code>Order<\/code><\/td><td><code>Require ip 10.0.0.0\/8<\/code><\/td><\/tr><tr><td>Rule precedence<\/td><td>Depends on the <code>Order<\/code> directive<\/td><td>Uses explicit <code>Require<\/code> authorization logic<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Core HTTP interview questions (quick answers)<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>What is the difference between 301 and 302?<\/strong> 301 is permanent redirection; 302 is temporary redirection.<\/li><li><strong>What does HTTP 304 mean?<\/strong> Resource not modified, so cached content can be reused.<\/li><li><strong>Why is the Host header important?<\/strong> It enables name-based virtual hosting by identifying the target domain.<\/li><li><strong>Which methods are idempotent?<\/strong> GET, PUT, DELETE, HEAD, and OPTIONS are expected to be idempotent.<\/li><li><strong>What is keep-alive?<\/strong> Reusing a TCP connection for multiple HTTP requests to reduce connection overhead.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting commands interviewers expect you to know<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Show loaded modules<\/span>\nsudo apachectl -M\n\n<span class=\"hljs-comment\"># Show active virtual host mapping<\/span>\nsudo apachectl -S\n\n<span class=\"hljs-comment\"># Confirm Apache is listening on expected ports<\/span>\nsudo ss -ltnp | egrep <span class=\"hljs-string\">':80|:443'<\/span>\n\n<span class=\"hljs-comment\"># Inspect response headers quickly<\/span>\ncurl -I http:<span class=\"hljs-comment\">\/\/127.0.0.1\/<\/span>\n\n<span class=\"hljs-comment\"># Follow error logs (path varies by distribution)<\/span>\nsudo tail -f \/<span class=\"hljs-keyword\">var<\/span>\/log\/httpd\/error_log<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Common pitfalls<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Using legacy 2.2 access-control syntax in 2.4 environments without validating compatibility.<\/li><li>Reloading Apache before running <code>apachectl -t<\/code>.<\/li><li>Assuming service names and log paths are identical across all Linux distributions.<\/li><li>Using force-kill commands instead of controlled stop\/reload procedures.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A modernized Apache and HTTP interview guide with practical, production-focused answers. Includes command comparisons, config examples, and a safe change workflow.<\/p>\n","protected":false},"author":1,"featured_media":4297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[52],"tags":[420,3948,3951,3942,3943,3949,3916,3945,3940,3947,3946,766,3950,507,3944,1553,3941,1830,3910,637],"class_list":["post-258","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview-questions-answers","tag-apache","tag-apache-and-http-interview-guide","tag-apache-and-http-interview-qa","tag-apache-and-http-interview-questions-and-answers","tag-apache-and-http-job-interview","tag-apache-http-job-interview-kit","tag-apache-interview","tag-apache-interview-questions-and-answers","tag-http","tag-http-interview","tag-http-interview-questions-and-answers","tag-interview","tag-interview-questions-of-apache-and-http","tag-list","tag-list-of-apache-and-http-interview-questions-and-answers","tag-most-asked","tag-questions-and-answers","tag-selected","tag-sets","tag-top"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":79086,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions\/79086"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4297"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}