About the Apache Config Builder
Apache configuration is order-sensitive and section-scoped in ways that produce confident, wrong behaviour rather than errors. This builder generates virtual host blocks with the directives in a working arrangement, which removes most of the guesswork about what belongs where.
The distinction that causes the most trouble is between Directory, Location, and Files sections. Directory matches filesystem paths, Location matches request URLs, and they are evaluated in a defined order with Location applied later — so a permissive Location can override the Directory restriction you thought was protecting something.
Behind a reverse proxy or load balancer, the second recurring problem is logging and authorising against the wrong address. Without remoteip configured to trust the forwarding header, every log line and every IP-based rule sees the proxy rather than the client.
Frequently asked questions
What is the difference between Directory, Location, and Files?
Directory applies to a filesystem path and everything beneath it. Files applies to filenames regardless of location. Location applies to the request URL and is what you want for endpoints with no file behind them, such as a proxied path or a status handler. Merge order matters: Directory sections are applied before Location sections, so Location wins on conflict.
How do I redirect HTTP to HTTPS correctly?
Use a Redirect directive in a dedicated port 80 virtual host rather than a rewrite rule — it is clearer and cheaper. Make it a permanent redirect so clients and search engines cache it. Then add HSTS on the HTTPS host so browsers stop making the plaintext request at all, but only once you are confident every subdomain can serve TLS.
Why are all my access logs showing the load balancer IP?
Because that is the peer Apache is talking to. Enable the remoteip module, set the header your proxy sends, and declare the trusted proxy addresses. Never trust the header unconditionally — if any client can set it, IP-based rules and rate limits can be spoofed trivially.
Should I use .htaccess files?
Not if you control the main configuration. Allowing them forces Apache to check for the file in every directory along the path on every single request, which is a measurable cost. They also fragment configuration across the filesystem. Their real use case is shared hosting where users cannot edit the server config.
What is the difference between ProxyPass and ProxyPassReverse?
ProxyPass forwards the request to the backend. ProxyPassReverse rewrites the Location, Content-Location, and URI headers in the response so redirects issued by the backend point at the public hostname rather than the internal one. Omitting it produces a proxy that works until the backend issues a redirect and sends the client to an unreachable internal address.
Need this managed for you, not just automated?
We're also a hands-on DevOps consultancy — Kubernetes, CI/CD, and cloud infrastructure.