Nginx and Memcache

Maxim Dounin mdounin at
Fri Oct 22 19:54:45 MSD 2010


On Fri, Oct 22, 2010 at 09:39:03AM -0400, midas wrote:

> Hi,
> I have recently installed Nginx as a front facing server to communicate
> with memcache. My problem is that the PHP code that writes into memcache
> serializes the contents. I cannot turn off serialization but need to
> figure out how to get the string content from memcache. The current
> output from Nginx is of type application/octet-stream. Is there
> something I missed? 

As memcached values doesn't store/return any content type - nginx only 
able to detect it based on request uri extension (i.e. the same 
logic as for static files applies).

See details here:

E.g to make sure all replies from memcached are returned as 
text/plain do something like this:

    location /memcached/ {
        types {}
        default_type text/plain;
        memcached_pass ...

Maxim Dounin

More information about the nginx mailing list