Ich möchte Lack für Symfony verwenden und für meine eZ Platform CMS.I haben dieses Tutorial folgte meinem Lack einzurichten: http://book.varnish-software.com/4.0/chapters/Getting_Started.html#exercise-install-varnishWie überprüft man, ob Varnish für Symfony aktiviert ist?
So habe ich die folgenden Arbeits Server:
- Varnish hört auf Port 80
Varnish Verwendet Backend auf localhost: 8080
Apache hört auf localhost: 8080
Ich habe auch meine eZ Platform ezplatform.yml und ezplatform.conf eingerichtet, um den Standard-Cache zu deaktivieren und Lack zu aktivieren (ich denke).
Ich habe diese beiden Linie https://doc.ez.no/display/TECHDOC/Using+Varnish Folling die Dokumentation ezplatform.conf:
:SetEnv USE_HTTP_CACHE 0
SetEnv TRUSTED_PROXIES "0.0.0.0"
I für Varnish Server-IP-Adresse setzen 0.0.0.0 weil netstat mir die folgenden Adressen für Varnish Server retreive -nlpt
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 11151/varnishd
tcp 0 0 127.0.0.1:1234 0.0.0.0:* LISTEN 11151/varnishd
Also ich denke, das ist der richtige Wert. Dann fügte ich die folgenden Zeilen zu meinem ezplatform.yml (die Dokumentation oben markiert):
ezpublish:
http_cache:
purge_type: http
siteaccess:
list: [site]
groups:
http_cache:
purge_servers: 0.0.0.0:80
Varnish und httpd auch neu gestartet. Dann habe ich geprüft, ob Varnish durch lokale Website verwendet wurde, die HTTP-Header überprüft, und ich habe dies:
Via: "1.1 varnish-v4"
X-Varnish: "32808"
Welche ist, denke ich, ein guter Fortschritt. Anyaway, Im Symfony-Profiler, ich habe immer noch die folgenden Intel:
Cache Information
Default Cache default
Available Drivers Apc, BlackHole, FileSystem, Memcache, Redis, SQLite
Total Requests 349
Total Hits 349
Cache Service: default
Drivers FileSystem
Calls 349
Hits 349
Doctrine Adapter false
Cache In-Memory true
Ist es normal, dies noch zu bekommen? Sollte es nicht so etwas wie Default Cache sein: Lack statt Standard? Wie kann ich überprüfen, ob mein Varnish momentan auf meiner Site arbeitet und nicht den Symfony Default Cache?
Btw, hier ist meine vcl-Datei:
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;
import directors;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_init {
new backs = directors.hash();
backs.add_backend(default, 1);
}
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.
set req.http.X-cookie = req.http.cookie;
if (!req.http.Cookie ~ "Logged-In") {
unset req.http.Cookie;
}
if (req.url ~ "\.(png|gif|jpg|png|css|js|html)$") {
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.
}
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.
}
Auch wenn es nicht zu Ende ist, verstehe ich nicht, wie der Cache Symfony Standard noch funktioniert, da ich es in der Konfigurationsdatei deaktiviert.
Vielen Dank für Ihre Hilfe.
Vielen Dank für Ihre Antwort. Was ich seltsam fand, war die Tatsache, dass Symfony Profiler nicht zeigt, ob Varnish aktiv ist oder nicht. Ich habe bestätigt, dass der Lack mit Firnisstat gearbeitet hat. – Ecterion