server { listen 80; server_name domain.ltd; access_log /var/log/nginx/localhost.access.log; error_log /var/log/nginx/error.log debug; location / { set $domain "http://domain.ltd"; if ($request_method = POST) { proxy_pass http://domain.ltd; break; } # set default memcache key set $href $host$request_uri; if ($http_cookie ~* "be_typo_user") { proxy_pass http://domain.ltd; break; } if ($http_cookie ~* "nginx_boost_fe_user=([^;]+)(?:;|$)") { set $href $host$request_uri$1; } set $memcached_key $href; # Check if local memcached server can answer this request default_type text/html; memcached_pass 192.168.168.3:11211; # Send to app. server if Memcached could not answer the request error_page 404 502 = /cache_miss$request_uri; } # Main location location /cache_miss/ { proxy_pass http://domain.ltd; } location ~ ^/(images|javascript|js|css|flash|media|fileadmin|typo3temp|static|uploads)/ { proxy_pass http://domain.ltd; } }