memcached_pass

The `memcached_pass` directive is used to route requests to a memcached server.

Syntaxmemcached_pass address;
Defaultnone
Contextlocation, if in location
Arguments1

Description

The memcached_pass directive allows an NGINX server to pass requests for cached data to a specified memcached server. This directive is useful in scenarios where you want to cache pages or data for faster access and need to retrieve those from a memcached backend. The directive accepts a single argument, which is the address of the memcached server, and can be placed inside a location block or an if block within a location.

Config Example

location /cache {
    memcached_pass 127.0.0.1:11211;
}

Ensure the memcached server is running and accessible at the provided address.

Avoid using memcached_pass inside a try_files block as it may not behave as expected.

Configuration errors may lead to NGINX being unable to establish a connection to the memcached server.

← Back to all directives