2016-11-26 7 views
0

Мне удалось настроить лак, но это не кеширование, я думаю. В заголовке ответа, я вижу эти атрибуты:Лак Не кэширование сайта WordPress. Пробовал некоторые решения, представленные в блогах. Ничего не сработало для меня

Url : corp.zip.pr 

Age →0 
Via →1.1 varnish-v4 
X-Varnish →98319 

Мой файл default.vcl, как показано ниже:

# Marker to tell the VCL compiler that this VCL has been adapted to the 
# new 4.0 format. 
vcl 4.0; 

# Default backend definition. Set this to point to your content server. 
backend default { 
.host = "127.0.0.1"; 
.port = "8080"; 
} 

sub vcl_recv { 
# Happens before we check if we have this in cache already. 
# 
# Typically you clean up the request here, removing cookies you don't need, 
# rewriting the request, etc. 

if (req.method == "PURGE") { 

if (req.http.X-Purge-Method == "regex") { 

ban("req.url ~ " + req.url + " && req.http.host ~ " + req.http.host); 

return (synth(200, "Banned.")); 

} else { 

return (purge); 

} 
} 


if (req.url ~ "wp-admin|wp-login") { 
return (pass); 

} 

if (!(req.url ~ "wp-(login|admin)")) { 
       unset req.http.cookie; 
} 


set req.http.cookie = regsuball(req.http.cookie, "wp-settings-d+=[^;]+(;)?", ""); 

set req.http.cookie = regsuball(req.http.cookie, "wp-settings-time-d+=[^;]+(;)?", ""); 

set req.http.cookie = regsuball(req.http.cookie, "wordpress_test_cookie=[^;]+(;)?", ""); 

if (req.http.cookie == "") { 

unset req.http.cookie; 
} 
} 

sub vcl_backend_response { 
# Happens after we have read the response headers from the backend. 
# 
# Here you clean the response headers, removing silly Set-Cookie headers 
# and other mistakes your backend does. 


if (beresp.ttl == 120s) { 

set beresp.ttl = 600s; 

} 
} 

sub vcl_deliver { 
# Happens when we have all the pieces we need, and are about to send the 
# response to the client. 
# 
# You can do accounting or modifying the final object here. 
} 

Кроме того, varnishlog не работает. когда я набираю varnishlog в терминале, я вижу следующее сообщение.

Невозможно открыть /opt/bitnami/varnish/var/varnish/_.vsm: Нет такого файла или каталога

я проверил расположение файла. _.vsm нет здесь. Я проверил местоположение vsm, используемое процессом varnishd. он отличался

/var/lib/varnish/ip-172-31-10-1/ 

ответ