🚀 Ready to Land Your Dream IT Job? Visit Our Job Interview Portal!
500+ Cloud, Programming & Web Server Interview Questions | Mock Tests | AI-Powered Prep
🔗 Go to Job Interview Portal – Start Preparing Now!📑 Table of Contents
🌱 BEGINNER LEVEL
0–2 Years Experience – 60 Q&As
Core Apache concepts, installation, basic configuration, virtual hosts, and logs.
Q1
📖 STORY You join a company as a junior sysadmin. The senior asks, "What is Apache HTTP Server and why do we use it?"
Answer: Apache HTTP Server (httpd) is a free, open-source web server that powers ~30% of the internet. It serves static and dynamic content over HTTP/HTTPS, supports virtual hosting, authentication, URL rewriting, and a modular architecture. We use it because it's stable, secure, highly customizable, and runs on almost any OS.
💡 Tip: "Apache is the Swiss Army knife of web servers – reliable and extensible."
Q2
How do you install Apache on Ubuntu/CentOS?
Answer: Ubuntu/Debian: `sudo apt update && sudo apt install apache2`. CentOS/RHEL: `sudo yum install httpd` then `sudo systemctl start httpd`. The service name differs: apache2 vs httpd. Configuration files are in `/etc/apache2/` or `/etc/httpd/`.
Q3
What are the main Apache configuration files?
Answer: Main config: `httpd.conf` (or `apache2.conf`). Additional configs in `conf.d/` or `sites-available/`. The `Include` directive allows splitting into multiple files. Log files: `access_log`, `error_log`. Module configs in `mods-available/`.
Q4
What is a Virtual Host? How do you set up a name-based virtual host?
Answer: A Virtual Host allows one Apache instance to serve multiple websites. For name-based: ` ServerName www.example.com DocumentRoot /var/www/example `. Enable with `a2ensite` (Debian) or include the file.
Q5
Explain the difference between Apache Prefork, Worker, and Event MPMs.
Answer: Prefork: process-based, one request per process, non-threaded (mod_php safe). Worker: multi-process, multi-threaded; better concurrency. Event: similar to Worker but uses dedicated threads for keep-alive connections; best for high concurrency. Modern Apache defaults to Event MPM.
Q6
What port does Apache listen on by default? How to change it?
Answer: Port 80 for HTTP, 443 for HTTPS. Change with `Listen` directive: `Listen 8080`. Also adjust virtual host ``.
Q7
How do you restart Apache gracefully?
Answer: `sudo systemctl reload apache2` (or `apachectl -k graceful`). Graceful restart tells workers to finish current requests before restarting, avoiding dropped connections. `restart` is abrupt.
Q8
What is .htaccess? Pros and cons?
Answer: .htaccess allows directory-level configuration changes without restarting Apache. Pros: convenience for shared hosting. Cons: performance hit (Apache scans every directory in the path for .htaccess files per request). Best practice: disable with `AllowOverride None` and use main config.
Q9
How do you enable/disable Apache modules? (Debian example)
Answer: `sudo a2enmod rewrite` to enable, `sudo a2dismod rewrite` to disable, then `sudo systemctl restart apache2`. Modules are symlinked from `mods-available/` to `mods-enabled/`.
Q10
What is DocumentRoot?
Answer: The directory from which Apache serves files for a virtual host. Example: `DocumentRoot /var/www/html`. Apache will serve `index.html` when the directory is requested.
Q11
How do you enable HTTPS/SSL in Apache?
Answer: Enable `mod_ssl`, create a virtual host on port 443, specify `SSLEngine on`, `SSLCertificateFile` and `SSLCertificateKeyFile`. Self-signed for testing, trusted CA for production. Use `sudo a2enmod ssl` and `sudo a2ensite default-ssl` (Debian).
Q12
What is Apache's access log format? How to customize?
Answer: Common Log Format (CLF): `%h %l %u %t \"%r\" %>s %b`. Customize with `LogFormat` directive, e.g., `LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined`. Use `CustomLog` to apply format.
Q13
How do you redirect HTTP to HTTPS?
Answer: Using mod_rewrite: `RewriteEngine On; RewriteCond %{HTTPS} off; RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]`. Or a simpler Redirect directive in the HTTP virtual host: `Redirect permanent / https://example.com/`.
Q14
What is the difference between and blocks?
Answer: `` applies to filesystem paths; `` applies to URL paths. `` is resolved first. Use `` for filesystem permissions, `` for URL-based access control.
Q15
How do you set up basic authentication in Apache?
Answer: Use `mod_auth_basic`. Create a password file with `htpasswd -c /etc/apache2/.htpasswd user`. Then in config: ` AuthType Basic AuthName "Restricted" AuthUserFile /etc/apache2/.htpasswd Require valid-user `.
Q16
What is mod_rewrite and what is it used for?
Answer: mod_rewrite is a powerful URL rewriting module. It can rewrite incoming URLs based on rules (regex), redirect, proxy, or map URLs to files. Commonly used for SEO-friendly URLs, redirects, access control. `RewriteRule ^old-page.html$ new-page.html [R=301,L]`.
Q17
How do you check Apache configuration syntax?
Answer: Run `apachectl configtest` or `httpd -t`. It checks the syntax of all configuration files and reports errors. Always run before restarting.
Q18
What is the purpose of mod_dir? What is DirectoryIndex?
Answer: mod_dir handles directory requests. The `DirectoryIndex` directive specifies which file to serve when a directory is requested (e.g., `DirectoryIndex index.html index.php`). It lists files in order of preference.
Q19
How do you restrict access by IP address?
Answer: Use `Require ip 192.168.1.0/24` inside a `` or `` block. To deny: `Require all denied` then `Require ip ...`. Older syntax: `Order Deny,Allow; Deny from all; Allow from ...` (deprecated).
Q20
What is the default user/group Apache runs as? Why?
Answer: Usually `www-data` (Debian) or `apache` (RHEL). It's a non-privileged user for security – if Apache is compromised, the attacker has limited access. Only the parent process runs as root (to bind to port 80).
Q21
How do you list loaded Apache modules?
Answer: `apachectl -M` or `httpd -M`. Shows static and shared modules.
Q22
What is an Alias in Apache?
Answer: The `Alias` directive maps a URL path to a filesystem location outside the DocumentRoot. Example: `Alias /images /data/images`. Useful for shared resources.
Q23
How do you configure custom error pages?
Answer: `ErrorDocument 404 /custom_404.html` or `ErrorDocument 500 "Internal Server Error"`. Place within the virtual host or .htaccess.
Q24
What is KeepAlive? What are its settings?
Answer: KeepAlive allows multiple requests over a single TCP connection, reducing latency. Settings: `KeepAlive On`, `MaxKeepAliveRequests` (max requests per connection), `KeepAliveTimeout` (seconds to wait for next request).
Q25
Explain the meaning of 200, 301, 403, 404, 500 HTTP status codes.
Answer: 200 OK, 301 Moved Permanently (redirect), 403 Forbidden, 404 Not Found, 500 Internal Server Error. Knowing these helps in log analysis.
Q26
How do you block a specific user-agent?
Answer: Using mod_rewrite or SetEnvIf: `BrowserMatch "BadBot" bad_bot` then `Deny from env=bad_bot`. Or RewriteCond: `RewriteCond %{HTTP_USER_AGENT} BadBot [NC] RewriteRule .* - [F]`.
Q27
What is mod_status? How to enable it?
Answer: Provides a server status page. Enable `mod_status`, add: ` SetHandler server-status Require ip 127.0.0.1 `. Access via `http://localhost/server-status`.
Q28
How do you set up a simple reverse proxy with Apache?
Answer: Enable `mod_proxy` and `mod_proxy_http`. Then: `ProxyPass /app http://backend:8080/app` and `ProxyPassReverse /app http://backend:8080/app`.
Q29
What is the difference between and ?
Answer: The first listens on all IPs on port 80 (wildcard). The second binds to a specific IP. Name-based vhosts typically use the wildcard and ServerName to differentiate.
Q30
How do you enable gzip compression in Apache?
Answer: Enable `mod_deflate`. Then add output filter: `AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript`. Can also use `SetOutputFilter DEFLATE` for all.
Q31
Where are Apache log files stored by default?
Answer: Debian/Ubuntu: `/var/log/apache2/access.log` and `error.log`. RHEL/CentOS: `/var/log/httpd/`. Custom paths can be set with `CustomLog` and `ErrorLog` directives.
Q32
How do you troubleshoot a "Cannot bind to address" error?
Answer: Port is already in use. Check with `sudo netstat -tulpn | grep :80`. Maybe another Apache instance or another server (nginx) is running. Change the Listen port or stop the conflicting service.
Q33
What is the ServerName directive?
Answer: Sets the hostname and port that the server uses to identify itself. Example: `ServerName www.example.com:80`. Used in redirects and virtual host matching.
Q34
How do you set up PHP with Apache?
Answer: Install PHP and the Apache PHP module (mod_php) or use PHP-FPM with mod_proxy_fcgi. For mod_php, install `libapache2-mod-php` and restart Apache. PHP files are then processed.
Q35
What is .htpasswd and how to create it?
Answer: `htpasswd` is a tool to create user credentials for basic auth. `htpasswd -c /path/.htpasswd user1` creates file with user1. Add more users without `-c`. The file is used with `AuthUserFile`.
Q36
Explain Order, Allow, Deny vs Require (Apache 2.4+).
Answer: Apache 2.2 used `Order Allow,Deny` and `Allow from`. Apache 2.4+ uses `Require` directives (e.g., `Require all granted`, `Require ip 192.168`). The old syntax is deprecated.
Q37
What does "a2ensite" and "a2dissite" do?
Answer: Debian tools to enable/disable virtual host configurations by creating symlinks in `sites-enabled/`. Equivalent to `ln -s` manually.
Q38
How do you rotate Apache logs?
Answer: Use `logrotate` utility with a config in `/etc/logrotate.d/apache2`. Apache also has `rotatelogs` program for piped logging.
Q39
What is the purpose of mod_include? SSI?
Answer: Server-Side Includes (SSI) allows embedding dynamic content within HTML pages using special directives (e.g., ``). Enable `mod_include` and add `Options +Includes`.
Q40
As a beginner, how do you confidently answer "Tell me about your Apache experience"?
🎤 "I've installed and configured Apache on Linux, set up virtual hosts, enabled SSL, managed access controls, and analyzed logs. I'm comfortable with .htaccess for redirects and authentication. I use `apachectl configtest` before restarts and monitor server status. I'm currently learning performance tuning with MPMs."
Q41
What is the role of mod_log_config?
Answer: Enables flexible logging with custom formats. Without it, you can't use `LogFormat` or `CustomLog`. It's usually compiled in by default.
Q42
How do you deny access to a .htaccess file itself?
Answer: Add: ` Require all denied `. This is often included by default to prevent exposure of sensitive files.
Q43
What is the difference between a process and a thread in Apache MPMs?
Answer: Process has its own memory space; threads share memory within a process. Prefork uses processes (more memory, stable), Worker/Event use threads (less memory, better concurrency).
Q44
How do you enable directory listing?
Answer: `Options +Indexes` in the directory context. To disable: `Options -Indexes`. For security, directory listing is usually disabled in production.
Q45
What is Apache Tomcat? How is it different from Apache HTTP Server?
Answer: Tomcat is a Java servlet container (implements Java Servlet, JSP). Apache HTTP is a general web server. Often used together: Apache HTTP as frontend reverse proxy to Tomcat for Java apps.
Q46
How do you set up a simple Tomcat application behind Apache?
Answer: Use mod_proxy_ajp or mod_proxy_http. For AJP: `ProxyPass /app ajp://localhost:8009/app`. Ensure Tomcat's AJP connector is enabled.
Q47
What is the ServerRoot directive?
Answer: The top-level directory containing the server's config, error, and log files. Default: `/etc/apache2` or `/etc/httpd`. Relative paths in config are relative to ServerRoot.
Q48
How do you restrict access by hostname?
Answer: `Require host example.com` or `Require host .example.com`. Note: This requires DNS lookups, which can slow down requests. Prefer IP-based restrictions.
Q49
What does "MaxClients" (MaxRequestWorkers) control?
Answer: The maximum number of simultaneous connections that Apache will handle. Prevents resource exhaustion. Setting too low causes queued requests; too high can lead to swapping.
Q50
How do you display Apache version and compile settings?
Answer: `apachectl -V` (version and build parameters). `httpd -V` or `apache2 -v`.
Q51
What is a .well-known directory and how to serve it?
Answer: Used for domain validation (Let's Encrypt, etc.). Serve it with an Alias or within DocumentRoot. Example: `Alias /.well-known /var/www/letsencrypt/.well-known`.
Q52
How do you set a custom header in Apache response?
Answer: Use `mod_headers`: `Header set X-Custom-Header "MyValue"`. Or conditionally: `Header always set X-Frame-Options "SAMEORIGIN"`.
Q53
What is mod_cache and its types?
Answer: Disk-based (`mod_cache_disk`) and memory-based (`mod_cache_socache`). Caches responses to reduce server load. Requires `mod_cache` and the storage module. Cache control via `CacheEnable`.
Q54
How do you handle a situation where Apache won't start?
Answer: Check error log (`tail -f /var/log/apache2/error.log`). Run `apachectl configtest`. Look for syntax errors, port conflicts, missing modules, permission issues. Address the reported error.
Q55
What is the difference between `Redirect` and `RedirectMatch`?
Answer: `Redirect` matches simple URL prefixes. `RedirectMatch` uses regex. Example: `RedirectMatch 301 ^/old/(.*)$ /new/$1`.
Q56
How do you set the default charset to UTF-8?
Answer: `AddDefaultCharset UTF-8`. This adds `Content-Type: text/html; charset=UTF-8` to responses without an explicit charset.
Q57
What is the meaning of "AH00558: Could not reliably determine..." warning?
Answer: Apache cannot determine the fully qualified domain name. Set `ServerName` globally to a valid hostname or IP in httpd.conf to suppress it.
Q58
How do you set up a simple webdav with Apache?
Answer: Enable `mod_dav` and `mod_dav_fs`. Create a `` with `DAV On`, authentication, and lock file path. Rarely used now; replaced by Nextcloud, etc.
Q59
What is the purpose of the `AcceptFilter` directive?
Answer: Optimizes how the kernel accepts connections (e.g., `AcceptFilter http none` on Linux). Usually default is fine; tuning can improve performance under high load.
Q60
🤖 AI How is AI influencing Apache administration?
Answer: AI tools like ChatGPT can help generate Apache config snippets, debug log errors, suggest performance optimizations. Log analyzers using ML detect anomalies. But human oversight is still critical. In 2026, AI-assisted config generation and security hardening are emerging trends.
🔥 INTERMEDIATE LEVEL
2–5 Years Experience – 60 Q&As
Q61
📖 You're optimizing Apache for a high-traffic site. What MPM and settings would you choose and why?
Answer: Use Event MPM with `StartServers 2`, `MinSpareThreads 25`, `MaxSpareThreads 75`, `ThreadsPerChild 25`, `MaxRequestWorkers 400`. Event handles keep-alive connections efficiently. Also enable `mod_http2` for HTTP/2. Tune KeepAliveTimeout down to 2-5 seconds. Use PHP-FPM instead of mod_php to separate processes.
Q62
Explain HTTP/2 support in Apache. How to enable?
Answer: Apache 2.4.17+ supports HTTP/2 via `mod_http2`. Enable module, then add `Protocols h2 http/1.1` in the virtual host or globally. Requires SSL/TLS (h2). Improves performance with multiplexing.
Q63
What is mod_rewrite's RewriteCond? Provide an example blocking hotlinking.
Answer: `RewriteCond` sets conditions for the rule. Hotlink blocking: `RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [F]`.
Q64
How do you implement rate limiting in Apache?
Answer: Use `mod_ratelimit` (e.g., `SetOutputFilter RATE_LIMIT; SetEnv rate-limit 400`) for bandwidth throttling. For request rate limiting, use `mod_security` or `mod_evasive` (third-party). mod_qos is also an option.
Q65
What is mod_security and how to set up basic rules?
Answer: A web application firewall (WAF) module. Install, enable, include OWASP Core Rule Set (CRS). Configure in `modsecurity.conf`: `SecRuleEngine On`. Custom rules: `SecRule ARGS "@rx attack" "id:1,deny,status:403"`. Use `SecAuditLog` for logging.
Q66
How to set up a load balancer with Apache using mod_proxy_balancer?
Answer: Enable `mod_proxy_balancer` and one of the scheduler modules (byrequests, bytraffic). Define a balancer cluster: ` BalancerMember http://backend1:80 BalancerMember http://backend2:80 ProxyPass / balancer://mycluster/`.
Q67
How to configure Apache for WebSocket proxying?
Answer: Use `mod_proxy_wstunnel`. Enable it, then: `ProxyPass /ws/ ws://backend:8080/ws/` with `Upgrade` header handling. Apache 2.4.5+ supports `RewriteRule` with `[P]` and `ProxyWebsocketFallbackToProxyHttp`.
Q68
What are the best practices for securing Apache against DDoS?
Answer: Use mod_reqtimeout to limit request times, mod_qos for connection throttling, rate limiting with mod_evasive, disable unnecessary modules, keep MaxRequestWorkers reasonable, use a CDN/WAF in front, and enable `mod_security`. OS-level SYN cookies and iptables rate limits also help.
Q69
Explain SSL/TLS session caching and OCSP stapling.
Answer: `SSLSessionCache` improves TLS handshake performance. OCSP stapling (`SSLUseStapling on`) has the server fetch and attach OCSP response to the certificate, improving client privacy and speed. Use `SSLStaplingCache` to store responses.
Q70
How to set up a reverse proxy with caching?
Answer: Enable mod_cache, mod_cache_disk. Set `CacheEnable disk /` for the proxy context. Use `CacheDefaultExpire`, `CacheMaxExpire`. Combine with ProxyPass.
Q71
What is mod_remoteip? Why is it needed behind a proxy/load balancer?
Answer: When Apache is behind a reverse proxy or CDN, the client IP becomes the proxy's IP. mod_remoteip replaces the client IP with the X-Forwarded-For header value, restoring the real IP for logging and access control.
Q72
How to debug a 500 Internal Server Error when error log is empty?
Answer: Increase LogLevel to debug (`LogLevel debug`) temporarily. Check PHP/application logs. Use `strace` on Apache process. Check file permissions. Disable .htaccess to isolate. Check for segmentation faults (core dumps).
Q73
What is the difference between `ProxyPass` and `RewriteRule [P]`?
Answer: `ProxyPass` is simpler, maps URL paths to backend. `RewriteRule [P]` passes through mod_rewrite engine, allowing conditions. Both use mod_proxy. RewriteRule is more flexible for complex URL manipulations.
Q74
How to configure Apache to serve a maintenance page for all requests except a specific IP?
Answer: Use mod_rewrite: `RewriteEngine On; RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.100$; RewriteCond %{REQUEST_URI} !^/maintenance\.html$; RewriteRule ^.*$ /maintenance.html [R=503,L]`. Or use a redirect with ErrorDocument 503.
Q75
How to implement CORS headers in Apache?
Answer: Use mod_headers: `Header set Access-Control-Allow-Origin "*"` or specific origin. For preflight: `Header set Access-Control-Allow-Methods "GET,POST,OPTIONS"` and handle OPTIONS method.
Q76
Explain the concept of "graceful restart" and how it preserves connections.
Answer: Graceful restart (`apachectl graceful`) tells child processes to exit after finishing current requests, while the parent reloads config and spawns new children. No connections are dropped, unlike a hard restart.
Q77
How to tune Apache for serving static files efficiently?
Answer: Disable .htaccess (`AllowOverride None`), enable `mod_expires` for caching headers, use `mod_deflate` for compression, increase `MaxRequestWorkers`, use Event MPM, disable unused modules, and set `EnableSendfile On` and `EnableMMAP On`.
Q78
What is the role of `mod_unixd`?
Answer: On Unix, it manages the worker processes/threads and sets the user/group. It's the core MPM support. You don't configure it directly, but it's essential for operation.
Q79
How to set up a wildcard virtual host?
Answer: Use `VirtualDocumentRoot`. Example: `VirtualDocumentRoot /var/www/%1`. Then `ServerAlias *.*` with regex. Or mod_vhost_alias. It maps subdomains to directories dynamically.
Q80
As an intermediate, how would you answer "Describe a challenging Apache problem you solved"?
🎤 "We had intermittent 503 errors due to backend connection timeouts via mod_proxy. I added `ProxyPass / http://backend/ connectiontimeout=5 timeout=30` and set `ProxyBadHeader Ignore`. Also configured retry logic with `retry=0`. Monitored with mod_status and found backend saturated. Then we added more Tomcat threads and a second backend with load balancer. Issue resolved."
Q81
What is mod_proxy_hcheck? How to enable dynamic health checks?
Answer: Available in Apache 2.4.21+ as a separate module. It performs HTTP health checks on backend servers. Enable with `ProxyHCExpr` and `ProxyHCTemplate`. Then set `ProxyPass / balancer://cluster/ hcmethod=GET hcuri=/health checkinterval=5`. Unhealthy backends are marked down.
Q82
How do you set up a Web Application Firewall with mod_security and the OWASP CRS?
Answer: Install mod_security, download OWASP CRS from GitHub, include `crs-setup.conf` and rules. Adjust anomaly scoring thresholds. Test with `curl` sending malicious payloads. Monitor SecAuditLog for false positives.
Q83
Explain `mod_macro` and how it simplifies configs.
Answer: mod_macro allows you to define reusable config blocks. Define a macro: ` ServerName $domain ... `. Then use: `Use VHost example.com`. Reduces duplication.
Q84
What is the difference between `MaxRequestWorkers` and `ServerLimit`?
Answer: `ServerLimit` is the hard maximum number of processes; `MaxRequestWorkers` is the total number of threads (or processes in Prefork). In Worker MPM, `ServerLimit * ThreadsPerChild` must be >= `MaxRequestWorkers`.
Q85
How to prevent slow HTTP DoS attacks (Slowloris)?
Answer: Use `mod_reqtimeout` to limit time to receive headers and body. Configure `RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500`. Also reduce Timeout and KeepAliveTimeout. mod_evasive or a reverse proxy like HAProxy can help.
Q86
How to enable Brotli compression in Apache?
Answer: Use `mod_brotli`. Add `AddOutputFilterByType BROTLI_COMPRESS text/html text/css application/javascript`. It provides better compression than gzip. Requires Apache 2.4.26+.
Q87
What is Apache JMeter? How is it related?
Answer: JMeter is a load testing tool, not directly part of Apache HTTP Server but an Apache Software Foundation project. Use it to test your Apache server performance.
Q88
How to configure Apache to use PHP-FPM via Unix socket?
Answer: Enable `mod_proxy_fcgi`. In virtual host: `ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php8.0-fpm.sock|fcgi://localhost/var/www/html/`. Adjust path.
Q89
Explain `mod_substitute` and its use case.
Answer: It modifies response body by applying regex substitutions. Example: `Substitute "s|http://internal|https://public|ni"`. Useful for fixing internal links when behind a reverse proxy.
Q90
How do you achieve high availability with Apache?
Answer: Multiple Apache instances behind a load balancer (ELB, HAProxy) with shared storage (NFS) for content or deploy identical content. Use Keepalived for active-passive VIP failover if no external balancer.
Q91
What is the purpose of `mod_unique_id`?
Answer: Generates a unique identifier for each request, stored in the environment variable `UNIQUE_ID`. Used for log correlation and request tracking.
Q92
How to set up Apache with Let's Encrypt SSL certificate automatically?
Answer: Use Certbot: `sudo certbot --apache -d example.com -d www.example.com`. It edits the virtual host config, obtains and installs certificate, sets up auto-renewal.
Q93
What is `mod_http2` and what are the benefits?
Answer: Enables HTTP/2 protocol support. Benefits: multiplexing, header compression, server push (deprecated in most browsers). Reduces latency and improves page load times.
Q94
How to handle a "prefork" memory issue causing OOM?
Answer: Switch to Event MPM if possible, reduce `MaxRequestWorkers`, use PHP-FPM to offload PHP processing, optimize modules, or increase server RAM. Monitor with `ps aux` and `top`.
Q95
What is the difference between `AllowOverride All` and `AllowOverride None`?
Answer: `All` enables .htaccess files; Apache checks each directory for them, impacting performance. `None` disables them, which is faster and more secure. Use `None` and place directives in main config.
Q96
How to log to syslog instead of files?
Answer: Use `ErrorLog syslog:local1` and `CustomLog "|/usr/bin/logger -t apache -p local1.info" combined`. Requires `mod_syslog` (or built-in).
Q97
What is `mod_info` and how to secure it?
Answer: Provides detailed server configuration info. Enable, then ` SetHandler server-info Require ip 127.0.0.1 `. Never expose to public.
Q98
Explain the `Listen` directive and how to listen on multiple ports.
Answer: `Listen 80` and `Listen 443`. Can also bind to specific IP: `Listen 192.168.1.10:8080`. Multiple Listen directives allow Apache to handle traffic on all listed ports.
Q99
What is `mod_ssl`'s `SSLCipherSuite`? How to set for strong security?
Answer: Defines the allowed TLS ciphers. Use a modern configuration: `SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:...` and disable old protocols with `SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1`.
Q100
How to prevent Apache from displaying its version?
Answer: Set `ServerTokens Prod` and `ServerSignature Off`. This hides version info from error pages and HTTP headers.
💎 EXPERT LEVEL
5–10 Years Experience – 60 Q&As
Q121
Design an Apache-based architecture to serve 50,000 concurrent users with dynamic content.
Answer: Use multiple Apache instances behind a hardware or cloud load balancer. Each instance runs Event MPM, tuned ThreadsPerChild=64, MaxRequestWorkers=4096. Static content served from a CDN (CloudFront). PHP processing via PHP-FPM on separate servers (or containers) with OPcache. Redis for session storage and caching. MySQL with read replicas. mod_proxy_balancer with sticky sessions if needed. Apache mod_security with CRS, rate limiting with mod_qos. Monitoring with Prometheus and Grafana. Horizontal scaling via Auto Scaling. This decouples web, app, and data tiers.
Q122
How to implement zero-downtime deployments with Apache?
Answer: Use blue-green deployment: Two sets of backend servers behind Apache reverse proxy. Update the inactive set, test, then swap the proxy's balancer member configuration (`BalancerMember` with `status=+H` for active, or change DNS/route53). Gracefully drain connections by setting the old backend to "drain" mode. For Apache itself, reload config gracefully; new children pick up changes while old ones finish.
👑 MOST EXPERT LEVEL
10+ Years Experience – 40 Q&As
Q181
You are asked to design a global Apache-based CDN-like service. What's your approach?
Answer: Use Apache Traffic Server (ATS) as the caching proxy, not vanilla httpd. ATS is designed for high-performance caching and can act as a reverse proxy/CDN. Otherwise, Apache with mod_cache and custom VCL-like logic. Deploy in multiple regions with GeoDNS (Route 53). Use consistent hashing for cache partitioning. Integrate with mod_security for edge security. Leverage Anycast for IP routing. This is an extremely advanced scenario requiring deep networking and caching expertise.
🎭 SCENARIOS (20 cases)
Scenario: Apache server returns 403 for all requests after deployment.
Check file permissions (www-data readable?), directory Options Indexes off, Require all granted? Check `
🧪 LABS (12)
LAB1
Set up a name-based virtual host with custom error pages.
Create two directories, enable site, add DocumentRoot and ServerName, restart, test. Use `ErrorDocument 404 /404.html`.
💻 CODE EXERCISES (12)
COD1
Write a shell script to parse Apache access log and count unique IPs.
#!/bin/bash
awk '{print $1}' /var/log/apache2/access.log | sort | uniq -c | sort -nr
🤖 AI TRENDS
AI1
AI-based Apache log anomaly detection
Tools like ElastAlert with ML, or AWS CloudWatch Logs Insights with anomaly detection, can automatically flag unusual error spikes, slow response times, or security threats based on Apache access/error logs.
📋 CHEAT SHEET
| Directive | Purpose |
|---|---|
| DocumentRoot | Sets the web root directory |
| Listen | Port to bind |
| ServerName | Hostname |
| ErrorLog | Error log path |
| RewriteEngine | Enable mod_rewrite |
🎯 Ace Your Next IT Interview! Visit Our Job Interview Portal
500+ Cloud, Web Server & Programming Q&As | Mock Tests | AI-Powered Prep
🚀 Go to Job Interview Portal – Start Preparing!

0 Comments
thanks for your comments!