Apache · Configuration and operations
Which mod_proxy modules and directives do you use most?
Short answer
mod_proxy is the core; protocol modules such as mod_proxy_http, mod_proxy_fcgi and mod_proxy_wstunnel handle specific backends. Most work is done with ProxyPass, ProxyPassReverse, ProxyPassMatch and balancer definitions.
mod_proxy itself does not speak a backend protocol. It delegates to protocol modules. That separation is why you must load both proxy_module and the relevant protocol module, and why a missing module shows up as an unsupported scheme rather than a configuration error.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
ProxyPassMatch "^/php/(.*[.]php)$" "unix:/run/php/php-fpm.sock|fcgi://localhost/var/www/app/$1"
ProxyPass /socket ws://127.0.0.1:3000/socket
ProxyPassReverse /socket ws://127.0.0.1:3000/socketCommon pieces
- mod_proxy_http: HTTP and HTTPS upstreams
- mod_proxy_fcgi: FastCGI, commonly PHP-FPM over a Unix socket
- mod_proxy_wstunnel: WebSocket tunneling
- mod_proxy_balancer: balancer groups and scheduling
- mod_proxy_hcheck: active backend health checks
- ProxyPassMatch: regex-based mapping, useful for path rewriting
Keep the module set minimal. Every enabled protocol module expands the surface area of what a misconfiguration can reach. A reverse proxy that only needs HTTP should not load FTP or AJP support, and forward proxying should remain off unless there is a deliberate, access-controlled use case.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Why do you need both mod_proxy and a protocol module?
- 2How does ProxyPassMatch differ from ProxyPass?
- 3Which module proxies WebSockets?
- 4How do you proxy PHP-FPM over a Unix socket?
Say it in the interview
mod_proxy is the framework and protocol modules do the work. For HTTP I load mod_proxy_http, for PHP-FPM mod_proxy_fcgi, and for WebSockets mod_proxy_wstunnel. I keep the set minimal and use ProxyPass for prefix mapping or ProxyPassMatch when the backend path needs a regex rewrite. I verify the module is loaded first whenever a proxy returns 503.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Apache mock interview and get scored feedback on depth, clarity and confidence.