• Hi guys.

    How does one go about setting up – in my case Nginx – a cache proxy for containerized WordPress?
    I do not suppose same rules nor recipes apply as when Nginx serves WordPress directly?
    Perhaps not all Docker images are good, or even are discouraged when Nginx on host is meant to be front-end to such WordPress?

    Any & all thoughts & advice are much appreciated.

    many thanks, L.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Run Nginx as a caching reverse proxy in its own container on the same Docker network as your WordPress container, so the whole setup stays portable and independent of the host. The same caching principles apply as when Nginx serves WordPress directly, but instead of fastcgi_pass to a local PHP socket you proxy_pass to the WordPress container’s service name over HTTP, and you must forward the Host header plus client IP headers so WordPress generates correct URLs. Exclude wp-admin, wp-login.php, and requests with logged-in cookies from the cache to avoid serving private content. Any plain WordPress image works fine as an upstream, so no special image is needed, just keep Nginx and WordPress as separate containers.

    Thread Starter lejeczek

    (@lejeczek)

    That is an option not for me, not for now at least – has to be Nginx on host.

    Btw. When http server caching up & running – is then a specific/any wp cache plugin redundant, optional or perhaps recommended?

    danielwebb

    (@danielwebb)

    You can use Nginx on the host as a reverse proxy and cache in front of a containerized WordPress setup. The key is to configure FastCGI or proxy caching based on how your containers are serving requests. Make sure to bypass the cache for logged-in users, admin pages, and requests with WordPress cookies. I’d also start with a trusted WordPress Docker image and get the reverse proxy working first, then enable caching and test carefully.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.