Enable content caching

NGINX as a Service for Azure supports caching via the ngx_http_proxy_module module, improving performance by allowing content to be served from cache without having to contact upstream servers. For more information on caching with NGINX, see NGINX Content Caching.

Configuring caching

http {
    # ...
    proxy_cache_path /var/cache/nginx keys_zone=mycache:10m;
}

NGINXaaS for Azure only supports caching to /var/cache/nginx. This is because data at /var/cache/nginx will be stored in a separate Temporary Disk. The size of the temporary disk is 4GB.

Limitations

Currently, proxy_cache_purge might not work as expected because NGINXaaS deploys multiple instances of NGINX Plus for high availability. The PURGE request will be routed to a single instance, and only the matched values on that instance will be purged.