Isaac
Isaac

Reputation: 299

Reverse proxy cache nginx + drupal without boost

in one of our sites, we want to create a reverse proxy cache structure with a drupal backend. Our structure is nginx + apache, and as we've tested in several sites, we don't want to do it with boost (we have our reasons, it is not the topic of this question).

What we want is something similar to our nginx + apache reverse proxy cache, doing all it on nginx, but it seems that I'm not lucky at searching for right solution: seems that all pages are nginx + drupal + boost.

Is there any proved solution that provides nginx configuration to reverse proxy cache a drupal backend without boost?

Thank you in advance,

Upvotes: 1

Views: 978

Answers (1)

Alex Ho
Alex Ho

Reputation: 36

You can create a simple nginx reverse proxy cache like so:

http {
    proxy_cache_path  /data/nginx/cache  keys_zone=CACHE_NAME:10m  max_size=500m;
    server {
        location / {
            proxy_pass             http://localhost;
            proxy_set_header       Host $host;
            proxy_cache            CACHE_NAME;
            proxy_cache_valid      200  302 60m;
            proxy_cache_valid      404  10m;
        }
    }
}
  • Set a proxy_cache_path in your HTTP directive
  • Provide a proxy name and shared memory zone inside keys_zone
  • Set a max_size for your cache folder

In the example above, proxy_cache_valid will cache 200 & 302 requests for 60m and 404 requests for 10m.

Read the full documentation on http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache for advanced configurations.

Hope this can get you started.

Upvotes: 0

Related Questions