Use it to configure or troubleshoot Apache sites.
Apache
Apache httpd (package apache2 on Debian, httpd on RHEL) is a modular web server with virtual hosts, .htaccess, and modules such as mod_ssl, mod_rewrite and mod_proxy.
1. apachectl configtest — Syntax OK?
2. apachectl -S — virtual hosts and default.
3. Module needed enabled? apachectl -M.
4. Error log: /var/log/apache2/error.log or /var/log/httpd/error_log.
5. Reload and test with curl.
request → listening socket → virtual host by name/port → modules and directives → content or proxy
For Web Services → Apache, continue with the first unproven Topic check: Identify package/service name, loaded config path/includes, modules/MPM and exact vhost request. If that boundary is healthy, advance to the adjacent check: Validate syntax, dump effective virtual-host/listener mapping and confirm socket ownership. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
apache config/includes → config test → unit/process + modules/MPM → Listen socket → vhost selection → filesystem/proxy handler → response/log
Healthy evidence: config test passes, expected modules are loaded, intended listener is owned by Apache, vhost selection matches Host/SNI and request logs correlate the expected response
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Identify package/service name, loaded config path/includes, modules/MPM and exact vhost request.
- Validate syntax, dump effective virtual-host/listener mapping and confirm socket ownership.
- Correlate access/error logs with one request and separate local handler, filesystem and upstream dependencies.
- Apply the smallest persistent config or dependency fix, reload safely, then repeat the original request.
Verification chain. apache config/includes → config test → unit/process + modules/MPM → Listen socket → vhost selection → filesystem/proxy handler → response/log
Step 3 Verification path Verify boundary
# Syntax and include check
sudo apachectl configtest # apache2ctl on Debian/Ubuntu
# Which vhost answers which name and port, and which is the default
sudo apachectl -S
# Loaded modules and MPM
sudo apachectl -M | sort
sudo apachectl -V | grep -i mpm
# Listening sockets and recent errors
sudo ss -ltnp | grep -E 'httpd|apache2'
sudo tail -n 50 /var/log/httpd/error_log # /var/log/apache2/error.log on Debian
# Request with a specific Host header to the local server
curl -sSI -H 'Host: www.example.com' http://127.0.0.1/
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: config is syntactically valid but wrong include/vhost wins, module/MPM differs from assumption, permission or SELinux blocks content, or proxy/backend failure is surfaced as an Apache error
Step 5 Common mistakes Narrow the fault
- Reloading without
configtest. - Relying on
.htaccesseverywhere instead of vhost configuration. - Forgetting that the first vhost is the default for unknown names (and certificates without SNI).
- prefork with mod_php on busy servers instead of event + PHP-FPM.
- Disabling SELinux instead of fixing contexts and booleans.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Config layout differs: Debian uses sites-available/sites-enabled with a2ensite/a2enmod; RHEL uses /etc/httpd/conf.d/. apachectl -S lists virtual hosts and which one is default. Reload with systemctl reload.
apachectl -S— virtual host overviewsystemctl status nginx|apache2|httpd— web server statenginx -t / apachectl configtest— configuration testss -ltnp | grep -E ':80|:443'— listening portscurl -vI https://<name>— response, headers and TLStail -f /var/log/nginx/error.log— error log (or apache2/httpd)
ReferenceWhat it is1 section · depth on demand
Direct Answer
Apache HTTP Server (httpd) is a modular web server. Requests are matched to a virtual host by IP:port and then by ServerName/ServerAlias; modules (mod_ssl, mod_proxy, mod_rewrite, mod_proxy_fcgi…) add features, and an MPM decides how connections are handled (event is the modern default). Always run apachectl configtest (or -t) before reloading, and use apachectl -S to see which virtual host serves which name.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Apache is confirmed only when the effective configuration and selected virtual host handle the exact request as intended; config syntax or service state alone is insufficient.
In depth
Apache httpd: MPMs, modules and configuration layout
Apache's behaviour under load depends on its Multi-Processing Module (MPM). The Apache documentation describes the choice:
eventandworkerare threaded MPMs for sites that need a great deal of scalability.preforksuits stability or compatibility with older software.- On systems with threads and thread-safe polling, the default is
event, which "will almost always" be the case. - Only one MPM can be loaded. With modular builds it's selected by a
LoadModuleline, andhttpd -lshows a compiled-in MPM.
MPMs and PHP
| Combination | Notes |
|---|---|
| prefork + mod_php | The classic setup; one process per connection; memory-hungry |
| event + PHP-FPM (via mod_proxy_fcgi) | The modern recommendation; PHP runs in its own pool |
| worker + mod_php | Not supported: mod_php isn't thread-safe |
Configuration layout by distribution
| Debian / Ubuntu | RHEL family | |
|---|---|---|
| Package and service | apache2 | httpd |
| Main file | /etc/apache2/apache2.conf | /etc/httpd/conf/httpd.conf |
| Sites | sites-available/ + a2ensite | conf.d/*.conf |
| Modules | mods-available/ + a2enmod | conf.modules.d/ |
| Logs | /var/log/apache2/ | /var/log/httpd/ |
| Control tool | apache2ctl | apachectl |
Settings worth knowing
| Directive | Purpose |
|---|---|
ServerTokens Prod, ServerSignature Off | Don't advertise the version |
AllowOverride None | Ignore .htaccess (faster, and centrally controlled) |
Options -Indexes | No automatic directory listings |
MaxRequestWorkers | Upper limit on simultaneous requests |
KeepAliveTimeout | How long idle connections are kept |
host$ apachectl -V | grep -i mpm
Server MPM: event
host$ apachectl -M 2>/dev/null | grep -E "mpm|proxy_fcgi|ssl|php"
mpm_event_module (shared)
proxy_fcgi_module (shared)
ssl_module (shared)
host$ sudo a2dismod php8.3 mpm_prefork && sudo a2enmod mpm_event proxy_fcgi setenvif && sudo a2enconf php8.3-fpm
host$ sudo apachectl configtest && sudo systemctl restart apache2
host$ sudo apachectl status | grep -E "requests currently being processed|idle workers"
Switching to event + PHP-FPM
The sequence above replaces mod_php and prefork with PHP-FPM behind event. An MPM change needs a full restart, not a graceful reload, because the process model itself changes. Check apachectl -M afterwards to confirm that only one MPM is loaded.
Documented example, not captured output.
How it works at runtime
Apache is part of Web Services → Apache. Apache HTTP Server operation on Linux centers on the effective httpd/apache2 configuration graph, loaded modules, MPM/process model, listeners, virtual-host selection, permissions and request logging.
Topic-specific state model. Apache HTTP Server operation on Linux centers on the effective httpd/apache2 configuration graph, loaded modules, MPM/process model, listeners, virtual-host selection, permissions and request logging.
Interpretation rule. - apachectl configtest success ≠ the intended vhost is selected.
- HTTPD active ≠ every configured listener or site is reachable.
- A default page ≠ the requested application virtual host is working.
- An Apache error log line ≠ Apache itself is the root cause when an upstream or filesystem dependency failed.
Quick reference
Layout by distribution
| Item | RHEL / Fedora | Debian / Ubuntu |
|---|---|---|
| Package / service | httpd | apache2 |
| Main config | /etc/httpd/conf/httpd.conf | /etc/apache2/apache2.conf |
| Extra config | /etc/httpd/conf.d/*.conf | sites-available/ → sites-enabled/ (a2ensite), conf-available/ |
| Modules | /etc/httpd/conf.modules.d/ | mods-available/ → mods-enabled/ (a2enmod) |
| Logs | /var/log/httpd/ | /var/log/apache2/ |
| Control | apachectl, systemctl reload httpd | apache2ctl, systemctl reload apache2 |
Virtual host selection
Apache first finds the best IP:port match (<VirtualHost 10.0.0.1:443> beats <VirtualHost *:443>); only among vhosts tied at that level does it compare the Host header (or SNI) with ServerName/ServerAlias in configuration order. If none matches, the first vhost listed for that address is the default — which is why an unknown name shows another site. Without SNI on HTTPS, the first name-based vhost also decides the certificate.
MPMs
| MPM | Model | Use |
|---|---|---|
| prefork | One process per connection, no threads | Only for non-thread-safe modules such as embedded mod_php |
| worker | Processes with threads | General use |
| event | Like worker, with keep-alive connections handled by a listener thread | Default on current distributions; use with PHP-FPM |
Size MaxRequestWorkers to memory; when it is reached, requests queue and the error log says so.
Access control and overrides
Apache 2.4 uses Require (Require all granted, Require ip 10.0.0.0/8). .htaccess files are read on every request where AllowOverride permits them — convenient on shared hosting, slower and harder to audit; prefer configuration in the vhost.
PHP
Current practice is event MPM plus PHP-FPM through mod_proxy_fcgi (SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"), instead of mod_php with prefork.
SELinux (RHEL family)
Content must carry httpd_sys_content_t (or _rw_t for writable paths), and proxying to back ends needs setsebool -P httpd_can_network_connect on. Denials show as 403/503 with AVC entries in the audit log.
Limits and how it fails
Primary failure point. Apache is confirmed only when the effective configuration and selected virtual host handle the exact request as intended; config syntax or service state alone is insufficient.
Apache/Nginx config syntax success is not application health.
ReferenceConfiguration & state2 sections · depth on demand
Configuration, persistence and lifecycle
Validate Apache/Nginx configuration before reload and understand virtual-host/SNI/default-server selection.
Distribution/platform context. Apache owns HTTPD-specific configuration and request handling; TLS, filesystem permissions and reverse proxy dependencies remain separate things to check.
Lifecycle and ownership
- Change: edit,
apachectl configtest, thensystemctl reload(graceful — existing connections finish). - Sites: one file per vhost; enable/disable with
a2ensite/a2dissite(Debian) or by file name inconf.d(RHEL). - Modules: load only what is used; review after upgrades.
- TLS: certificates renewed by ACME clients need a reload hook (ACME Certificate Automation).
- Logs: rotated by logrotate; keep error log level
warnexcept while debugging.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Web Services → Apache. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://nginx.org/en/docs/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Apache operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Apache.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Apache HTTP Server operation on Linux centers on the effective httpd/apache2 configuration graph, loaded modules, MPM/process model, listeners, virtual-host selection, permissions and request logging. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact client/server + time + request/file operation → identify authoritative configuration → read back effective service/listener/session state → trace protocol selection/auth/identity → verify backend/upstream boundary → correlate logs → make smallest persistent change → repeat original workload + regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | apache config/includes → config test → unit/process + modules/MPM → Listen socket → vhost selection → filesystem/proxy handler → response/log | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Apache is proven only when the effective configuration and selected virtual host handle the exact request as intended; config syntax or service state alone is insufficient. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux web/file-service evidence can establish this proof path: apache config/includes → config test → unit/process + modules/MPM → Listen socket → vhost selection → filesystem/proxy handler → response/log | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved clients, names, identities, routes, sessions, backends or time periods. Apache is proven only when the effective configuration and selected virtual host handle the exact request as intended; config syntax or service state alone is insufficient. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven service boundary, capture adjacent effective state and protocol/application evidence, make only the demonstrated persistent change, then repeat the original client workload plus a regression check. | Continue to the next unresolved boundary while preserving the original test condition. |
Apache · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Apache |
|---|---|
| Topic path | Web Services → Apache |
| Runtime state | Apache HTTP Server operation on Linux centers on the effective httpd/apache2 configuration graph, loaded modules, MPM/process model, listeners, virtual-host selection, permissions and request logging. |
| Fast checks | - Identify package/service name, loaded config path/includes, modules/MPM and exact vhost request. - Validate syntax, dump effective virtual-host/listener mapping and confirm socket ownership. - Correlate access/error logs with one request and separate local handler, filesystem and upstream dependencies. - Apply the smallest persistent config or dependency fix, reload safely, then repeat the original request. |
| Verification chain | apache config/includes → config test → unit/process + modules/MPM → Listen socket → vhost selection → filesystem/proxy handler → response/log Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | Apache is proven only when the effective configuration and selected virtual host handle the exact request as intended; config syntax or service state alone is insufficient. Boundary chain: unit config/drop-ins → dependency/order/condition → exec/process → readiness/active state → owned socket/file/device → dependent client/workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |
Deep reference
Healthy vs suspicious evidence
Output interpretation
| Observation | Meaning |
|---|---|
apachectl -S: *:443 is a NameVirtualHost with default server … | The listed default answers names that match no vhost |
AH00558: Could not reliably determine the server's fully qualified domain name | Harmless warning — set a global ServerName |
AH00072: make_sock: could not bind to address | Port already in use or no permission |
AH00161: server reached MaxRequestWorkers setting | All workers busy — slow back end or too few workers |
AH01630: client denied by server configuration | Require rules deny access |
Permission denied (13) with SELinux enforcing, AVC entries in the audit log | File context or boolean missing |
failed to make connection to backend / attempt to connect to … failed | Back end (PHP-FPM, app server) unreachable — 503 to clients |