How to run Apache behind Nginx

Understand and configure the Nginx-in-front-of-Apache setup on TurboStack.

On TurboStack, Apache runs as a backend behind nginx. Nginx handles the edge - Transport Layer Security (TLS), static files and (if enabled) the Varnish cache - and forwards dynamic requests to Apache, which runs your application and reads .htaccess. This gives you Apache's per-directory flexibility with Nginx's performance at the front.

How requests flow

  1. A request arrives at Nginx (and Varnish, if enabled), which terminates HTTPS and serves cached or static content.

  2. Dynamic requests are proxied to Apache, which runs the application and applies any .htaccess rules.

Set it up

Choose Apache as the host's web server by setting webserver: apache2 - see Configure Apache. TurboStack wires Nginx in front of Apache for you; there is no proxy configuration to write by hand.

What you configure where

Concern Where
TLS, HTTP-to-HTTPS redirect, static files, caching (Varnish) Nginx (managed by the platform)
Per-directory rules, rewrites, access control, headers Apache .htaccess in your web root

When to choose this setup

Choose Apache when your application depends on .htaccess rules that it ships and maintains itself. If you do not need .htaccess, Nginx alone (webserver: nginx) is the lighter default - see Configure Nginx.