Changeset 3273044
- Timestamp:
- 04/15/2025 07:23:38 AM (12 months ago)
- Location:
- ergonet-varnish-cache
- Files:
-
- 4 added
- 3 edited
-
tags/1.0.10/varnishCache.php (modified) (1 diff)
-
tags/1.0.11 (added)
-
tags/1.0.11/index.php (added)
-
tags/1.0.11/readme.txt (added)
-
tags/1.0.11/varnishCache.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/varnishCache.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ergonet-varnish-cache/tags/1.0.10/varnishCache.php
r3189420 r3273044 54 54 function pluginInfo() 55 55 { 56 add_options_page(" Varnish Cache", "Ergonet VarnishCache", 'manage_options', 'varnishCacheInfo', array($this, 'pageContent'));56 add_options_page("Ergonet Cache", "Ergonet Cache", 'manage_options', 'varnishCacheInfo', array($this, 'pageContent')); 57 57 } 58 58 -
ergonet-varnish-cache/trunk/readme.txt
r3189420 r3273044 4 4 Requires at least: 4.9 5 5 Tested up to: 6.7 6 Stable tag: 1.0.1 06 Stable tag: 1.0.11 7 7 Requires PHP: 7.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 WordPress plugin for automating Varnish purge on articles and pages. This plugin is designed to work on [Ergonet hosting services](https://www.ergonet.it/ "Ergonet hosting services").11 Ergonet Cache for WordPress is a free plugin developed by Ergonet srl, an Italian hosting company, to drastically improve the performance of a WordPress website by using a server-side page caching system (NGINX Cache or Varnish Cache). 12 12 13 == Description == 13 BENEFITS 14 14 15 == ERGONET VARNISH CACHE FOR WORDPRESS == 16 Ergonet Varnish Cache is a free plugin developed by Ergonet srl, an Italian hosting company, to improve performance of a website developed in WordPress. 15 Using a server-side caching system increases your WordPress site's performance by a minimum of 30% and up to 70%. Keep in mind that the actual improvement will also depend on your overall website optimization strategy. 17 16 18 == BENEFITS == 17 WHAT IS PAGE CACHE AND HOW DOES IT WORK? 19 18 20 Using a reverse proxy system based on Varnish web accelerator will increase performance of your WordPress site starting from a minimum of 30% to a maximum of 60%. Remember that the performance improvement will also depend on the entire optimization strategy of your website.19 Page cache speeds up your website by storing the entire HTML of web pages directly on the web server, instantly serving them to visitors without needing to query the PHP server or the database again. Depending on your hosting plan, you can enable NGINX page cache (Equilibrio plan) or advanced RAM-based Varnish page cache (Progresso and Successo plans). 21 20 22 == WHAT IS VARNISH? == 21 COMPATIBILITY 23 22 24 Varnish is an http accelerator (also called reverse proxy) that saves entire WordPress sites pages on RAM memory, the fastest storage available, returning them immediately to the website visitor.25 The refore, if a specific page of your site has already been visited previously and is available in cache, Varnish will immediately return it to the user who is requesting it, without requesting its generation again from your WordPress site.26 If a visitor visits a page not yet in cache, Varnish will request it directly to Apache / NGINX web server, adding it to cache to speed up next requests of the same resource.23 The Ergonet Cache plugin is compatible with all other website caching and optimization plugins, such as WP Rocket, W3 Total Cache, WO Optimize, etc. 24 The Ergonet Cache plugin functions solely as a communication layer between WordPress and the cache system (Varnish or NGINX) installed on the WordPress hosting platform (any plan) and dedicated cloud hosting (Solo and Multidomain plans) offered by Ergonet, available for purchase at this link: https://www.ergonet.it/hosting/hosting-wordpress-valore 25 A fundamental requirement for the plugin to work is enabling the caching system from the WebPanel (Ergonet client area available at https://webpanel.ergonet.it) by the user who purchased the shared or dedicated cloud hosting service. 27 26 28 == COMPATIBILITY == 27 HOW THE PLUGIN WORKS 28 Once the caching system is enabled from the Ergonet WebPanel and the Ergonet Cache plugin is installed and activated, it will work without any additional configuration. 29 Cache resource updates 30 Each time the webmaster updates a post or page, the plugin installed in WordPress will automatically delete the old cached version to prevent users from seeing outdated content. 31 At the same time, the homepage cache will also be cleared to reflect any new articles available on it. 32 Cache resource deletion 33 Thanks to the automatic update and removal functionality, there is no need to manually clear the cache. Moreover, forcibly clearing the entire cache is discouraged, as it would remove all previously stored resources (pages, articles, etc.) that had been frequently accessed. 34 On websites with a large amount of content, a full cache purge could also cause significant slowdowns due to WordPress needing to regenerate all requested pages or articles from scratch. 29 35 30 Ergonet Varnish Cache is fully compatible with all other caching and website optimization plugins. For example WP Rocket, Autoptimize, W3 Total Cache, WP Fastest Cache and so on. However it's recommended to disable the Page caching option of these plugins, because, besides being less performing then Varnish, may lead to incompatibilities. 31 Ergonet Varnish Cache plugin works as a communication layer between WordPress and Varnish caching system installed on Ergonets hosting platform. Varnish is available on shared hosting plans with “Successo” performance profile and dedicated Cloud Hosting (Solo and Multidominio) available for purchase on https://www.ergonet.it 32 A fundamental requirement for the operation of the plugin is the activation of Varnish cache system from WebPanel (Ergonet customers area available at https://webpanel.ergonet.it) by the user who purchased hosting service. 36 WHAT IS NOT CACHED 37 To ensure the plugin works efficiently, some resources and specific HTTP calls are never cached. These include: 33 38 34 == HOW PLUGIN WORKS == 39 Any page, article/resource visited by a logged-in user. 40 Any page, article/resource where a no-cache header or similar is set. 41 All requests made to the WordPress backend. 42 All data submission requests (e.g., registration forms, contact forms, comments, etc.) 35 43 36 Once Varnish cache system is activated from Ergonets WebPanel and Ergonet Varnish Cache plugin is installed and activated, it will work without any additional configuration. 44 HOW TO CHECK IF CACHING IS WORKING 45 The server-side cache system sets specific HTTP headers indicating whether the requested resource (link) is cached or not. To verify if your website is using the cache correctly, you must check for these HTTP headers. 46 It's essential to ensure you are logged out of the WordPress site you're checking, as well as from any other WordPress site open in other browser tabs. The first step is therefore to log out from the WordPress admin area. 47 Open the developer tools based on your browser: 48 For Firefox: 37 49 38 Caching resources 39 A resource, intended as an URL, will be automatically added into Varnish cache when an anonymous user visits the page. 50 Menu → Browser Tools → Browser Console 40 51 41 Updating cached resources 42 Whenever the webmaster updates an article or page, the plugin will take care of deleting the old resource in the cache, to prevent users from viewing old content. 43 At the same time, homepage cache will also be deleted and updated with last articles. 52 For Chrome: 44 53 45 Clearing Cached Resources 46 Given the automatic update and removal of resources, there will be no need to forcibly clear cache. Furthermore, total cache deletion is a not recommended action, as it would delete all resources (pages, articles, etc.) that have been stored previously since they were heavily visited. 47 On sites with a lot of content, total cache deletion could also cause a significant slowdown, due to the need to regenerate from scratch all WordPress pages or articles requested by users. 54 View → Developer Options → Developer Tools 48 55 49 == WHAT WILL NOT BE CACHED == 56 Once the developer tools are open: 50 57 51 To make Varnish caching system efficient, there are some specific resources and HTTP calls that will never be cached: 58 Select the "Network" tab 59 In Firefox, choose the “HTML” sub-tab, in Chrome, choose “Doc” 60 Refresh the website page 61 Click on the first row showing the domain name or visited link (with status 200) 52 62 53 * Any page, article / resource visited by a logged in user. 54 * Any page, article / resource with no-cache header set. 55 * All WordPress backend calls. 56 * All calls made for data entry (registration form, contacts, comments and so on). 57 58 == HOW TO CHECK THAT VARNISH CACHE IS WORKING == 59 60 Varnish caching system sets specific headers if the called resource (link) is available or not in cache. To check if website is using Varnish cache, it is therefore necessary to check for the presence of specific Varnish headers. 61 62 Open your browser developer: 63 64 Firefox: tools->web development->Activate tools. 65 Chrome: View->development options->developer tools 66 67 Now, on developer tools: 68 * select “Network” tab 69 * select “HTML” sub tab in Firefox or “Doc” in Chrome 70 * refresh your page 71 * click on the domain name row identified by 200 status code 72 73 The response headers will open in the right column, last header will be the one related to Varnish: 74 75 X-VC-Cache: HIT = the resource, therefore the page called, is available in cache and has been returned by Varnish. It means that the cache system is working properly. 76 77 X-VC-Cache: MISS = the resource, therefore the page called, is NOT available in cache and was generated by WordPress application. It means that the cache system has been instructed by the application headers or by custom rules, not to return the content from cache. 78 79 == ACTIVATION OF VARNISH CACHE SYSTEM FROM WEBPANEL == 80 From Ergonets WebPanel additional Varnish configurations are available: 81 82 Cache expire 83 Recommended configuration: 1 week 84 Time retention of a given resource in cache. After this time, the resources available in Varnish cache that have reached this retention period will be deleted. 85 Remember that a resource (for example a page or an article), if modified or updated, will be deleted from the default cache, without considering its validity time and without the need to clear the entire cache. Whenever you update a page or article, homepage cache will also be invalidated. 86 87 Force cache 88 Recommended configuration: OFF 89 Some plugins or themes forces Cache Control headers to not allow Varnish to cache a resource. It is always preferable not to force this directive, as the headers are expected to be correctly set by applications, themes and plugins developers. 90 If activated, carefully check that there are no unexpected issues on website. 91 92 Dedicated memory (option only available on dedicated Cloud Hosting) 93 Recommended configuration: 128MB 94 Amount of RAM memory assigned to Varnish cache; 128MB is enough for most websites. For portals or e-commerces with a lot of content or products, we suggest setting it to 256MB or 512MB. 95 Keep in mind that the more RAM you will assign to Varnish, the less it will remain available for all other websites hosted on the same server and for the operating system. Increase the amount of Varnish RAM only if you have enough memory available. 96 97 Terms to exclude 98 Terms and words that if found on URLs should exclude content from being cached. There are already some default terms, but the list can be enriched if necessary by the user. 63 In the right-hand column, you'll see the response headers. The last header refers to the cache: 64 VARNISH CACHE HEADER 65 X-VC-Cache: HIT = the resource (page) is present in cache and was served from the Varnish cache system. This means the caching system is working properly. 66 X-VC-Cache: MISS = the resource (page) is NOT in cache and was generated by the WordPress application. This means the cache system was instructed by headers or custom rules not to serve the cached content to the visitor. 67 NGINX CACHE HEADER 68 x-cache-status: HIT or STALE = the resource (page) is present in cache and was served from the NGINX cache system. This means the caching system is working properly. 69 x-cache-status: MISS = the resource (page) is NOT in cache and was generated by the WordPress application. This means the cache system was instructed by headers or custom rules not to serve the cached content to the visitor. 70 ENABLING THE CACHING SYSTEM FROM THE WEBPANEL 71 The NGINX caching system is enabled by default and doesn’t require any specific settings. 72 To enable the Varnish caching system, we recommend checking the dedicated guide: https://docs.ergonet.it/gestione-hosting/impostazioni-cache-server/cache-varnish 99 73 == Installation == 100 74 … … 104 78 105 79 == Changelog == 80 81 = 1.0.11 = 82 Release date: April 15th, 2025 83 Welcome 1.0.11 release! 84 New: 85 – Add NGINX cache control 86 Other: 87 – Tested up with WordPress 6.7 106 88 107 89 = 1.0.6 = -
ergonet-varnish-cache/trunk/varnishCache.php
r3189420 r3273044 6 6 Plugin Name: Ergonet Cache 7 7 Description: Plugin per la gestione delle cache Nginx e Varnish su hosting Ergonet. 8 Version: 1.0.1 08 Version: 1.0.11 9 9 Author: Ergonet srl 10 10 Author URI: https://www.ergonet.it 11 11 License: GPLv2+ 12 Text Domain: ergonet- varnish-cache12 Text Domain: ergonet-cache 13 13 */ 14 14 … … 54 54 function pluginInfo() 55 55 { 56 add_options_page(" Varnish Cache", "Ergonet VarnishCache", 'manage_options', 'varnishCacheInfo', array($this, 'pageContent'));56 add_options_page("Ergonet Cache", "Ergonet Cache", 'manage_options', 'varnishCacheInfo', array($this, 'pageContent')); 57 57 } 58 58 59 59 function pageContent() 60 60 { 61 echo "<h3>ERGONET VARNISH CACHE FOR WORDPRESS</h3><p>Ergonet Varnish Cache for WordPress è il plugin gratuito sviluppato da Ergonet srl, azienda di hosting italiana, per migliorare drasticamente le performance di un sito web sviluppato in WordPress.</p><h3>BENEFICI</h3><p>L’utilizzo di un sistema di reverse proxy basato sull’acceleratore web Varnish aumenterà le performance del tuo sito in WordPress da un minimo del 30% ad un massimo del 60%. Ricorda che la percentuale di miglioramento dipenderà comunque anche dall’intera strategia di ottimizzazione del tuo sito web.</p><h3>COS’È VARNISH?</h3><p>Varnish è un acceleratore http (detto anche reverse proxy) che salva intere pagine del tuo sito in WordPress nella memoria RAM, il supporto più veloce che ancora oggi esista, restituendole immediatamente al visitatore del sito web.</p><p>Se quindi una determinata pagina del tuo sito è già stata visitata in precedenza ed è quindi presente in cache, Varnish la restituirà immediatamente all’utente che la sta richiedendo, senza richiederne nuovamente la generazione al tuo sito in WordPress.</p><p>Qualora un visitatore visitasse una pagina non ancora presente in cache, Varnish la richiederà direttamente al web server Apache/NGINX, inserendola nella cache per velocizzare una possibile futura nuova richiesta della stessa.</p><h3>COMPATIBILITÁ</h3><p>Ergonet Varnish Cache è compatibile con tutti gli altri plugin di cache e ottimizzazione del sito web. Ad esempio JCH Optimize e JotCache.</p><p>Il plugin Ergonet Varnish Cache funziona esclusivamente come layer di comunicazione tra WordPress e il sistema di cache Varnish installato sulla piattaforma server di <b>hosting per WordPress con profilo Successo e cloud hosting dedicati (Solo e Multidominio)</b> di Ergonet disponibili per l’acquisto sul sito https://www.ergonet.it</p><p>Un requisito fondamentale per il funzionamento del plugin è l’attivazione del sistema di cache Varnish dal WebPanel (area clienti Ergonet disponibile su https://webpanel.ergonet.it) da parte dell’utente che ha acquistato il servizio di hosting condiviso o cloud dedicato.<p><h3>COME FUNZIONA IL PLUGIN</h3><p>Una volta attivato il sistema di cache Varnish dal WebPanel di Ergonet e installato e attivato il plugin Ergonet Varnish Cache, lo stesso funzionerà senza alcuna configurazione aggiuntiva.</p></b>Inserimento delle risorse in cache</b><p>Una risorsa, intesa come URL, verrà inserita nella cache di Varnish nel momento in cui un utente non loggato visiterà la pagina.</p><b>Aggiornamento delle risorse in cache</b><p>Ogni volta che il webmaster aggiornerà un articolo o una pagina, il plugin installato in WordPress si occuperà di eliminare la vecchia risorsa presente in cache, per evitare che gli utenti visualizzino un contenuto vecchio.</p><p>Contestualmente verrà anche eliminata la cache della homepage, per aggiornare gli eventuali ultimi articoli disponibili nella stessa.</p><b>Cancellazione delle risorse in cache</b><p>Considerata la funzionalità di aggiornamento e rimozione automatica delle risorse, non sarà necessario cancellare forzatamente la cache per alcun motivo. Inoltre la cancellazione totale della cache è un’azione sconsigliata, in quanto eliminerebbe dalla stessa tutte le risorse (pagine, articoli, ecc) che sono state immagazzinate in precedenza poiché molto visitate.</p><p>Su siti con moltissimi contenuti l’operazione di cancellazione totale della cache potrebbe causare inoltre un rallentamento importante, causato della necessità da parte del sito in WordPress di rigenerare nuovamente da zero tutte le pagine o articoli richieste dagli utenti. </p><h3>COSA NON VIENE INSERITO IN CACHE</h3><p>Per rendere efficiente il sistema di cache Varnish, ci sono alcune risorse e chiamate HTTP specifiche che non verranno mai inserite in cache, ecco quali:</p><ul style=\"list-style: disc;padding-inline-start: 40px;\"><li>Qualsiasi pagina, articolo/risorsa visitato da un utente loggato.</li><li>Qualsiasi pagina, articolo/risorsa in cui viene settato un header no-cache e similari.</li><li>Tutte le chiamate dirette al backend di WordPress.</li><li> Tutte le chiamate eseguite per inserimento dati (form di registrazione, contatti, commenti e così via.)</li></ul><h3>COME VERIFICARE CHE LA CACHE VARNISH SIA FUNZIONANTE</h3><p>Il sistema di cache Varnish setta degli header specifici nel caso la risorsa (link) richiamata sia presente o meno in cache. Per verificare se il sito web stia sfruttando la cache Varnish è quindi necessario verificare la presenza degli header specifici di Varnish.</p><p>Aprire gli strumenti per sviluppatori in base al browser utilizzato:</p><p>Firefox tramite il menù:</p><p> strumenti -> sviluppo web -> Attiva strumenti.</p><p>Chrome tramite il menù: Visualizza -> opzioni per sviluppatori -> strumenti per sviluppatori</p><p>A questo punto si apriranno gli strumenti per sviluppatori:</p><ul style=\"list-style: disc;padding-inline-start: 40px;\"><li>selezionare la scheda “Rete” oppure “Network”</li><li>selezionare la sotto-scheda “HTML” in Firefox oppure “Doc” in Chrome</li><li>ricaricare il sito web eseguendo un refresh della pagina</li><li>cliccare sulla riga relativa al nome dominio identificato con stato 200</li></ul><p>Nella colonna di destra si apriranno gli Header di risposta, l’ultimo header sarà quello relativo a Varnish:</p><p><b>X-VC-Cache: HIT</b>= la risorsa, quindi la pagina richiamata, è presente in cache ed è stata restituita da Varnish. Significa che il sistema di cache sta funzionando correttamente.</p><p><b>X-VC-Cache: MISS</b>= la risorsa, quindi la pagina richiamata, NON è presente in cache ed è stata generata dall’applicazione WordPress. Significa che il sistema di cache è stato istruito dagli header dell’applicazione oppure da regole personalizzate, a non restituire il contenuto presente in cache al visitatore.</p><h3>ATTIVAZIONE DEL SISTEMA DI CACHE VARNISH DAL WEBPANEL</h3><p>Dal WebPanel Ergonet sarà possibile impostare alcune configurazioni aggiuntive per Varnish:</p><b>Validità della cache</b><br>Parametro consigliato: <i>1 settimana</i><p>È il tempo di conservazione di una determinata risorsa in cache. Dopo questa tempistica impostata dall’utente, le risorse presenti nella cache di Varnish che avranno raggiunto tale periodo di conservazione, verranno eliminate.</p><p>Ricorda che una risorsa (ad esempio una pagina o un articolo) se modificata o aggiornata, verrà eliminata dalla cache di default, senza considerare il suo tempo di validità e senza necessità di cancellare tutta la cache. Ogni qualvolta aggiornerai una pagina o un articolo, anche la cache della homepage verrà invalidata.</p><b>Forza cache</b><br>Parametro consigliato: <i>OFF</i><p>Alcuni plugin o temi forzano gli header Cache Control in un formato che non permette a Varnish di inserire una risorsa in cache. È sempre preferibile non forzare questa direttiva, in quanto si prevede che gli header vengano correttamente settati dagli sviluppatori delle applicazioni, template ed estensioni.<br>Se attivata, è necessario verificare con accuratezza che non si presentino anomalie sul sito web.</p><b>Memoria dedicata (opzione disponibile solo su Cloud Hosting dedicati)</b><br>Parametro consigliato: <i>128MB</i><p>È la quantità di memoria RAM dedicata alla cache Varnish e 128MB è una quantità sufficiente per la maggior parte dei siti web. Per portali o ecommerce con molti contenuti o prodotti, è possibile impostare la cache a 256MB oppure a 512MB.<br>Tieni presente che più memoria RAM dedicherai a Varnish, meno ne rimarrà a disposizione per tutti gli altri siti web ospitati sullo stesso server cloud e per il sistema operativo. Aumenta questo parametro solo se hai sufficiente memoria RAM a disposizione.</p><b>Termini da escludere</b><p>Sono i termini e vocaboli eventualmente presenti nelle URL che, se presenti, fanno sì che Varnish non inserisca in cache quella specifica risorsa. Sono presenti già alcuni termini di default, ma l’elenco può essere arricchito all’occorrenza dall’utente.</p>";61 echo "<h3>ERGONET CACHE</h3><p>Ergonet Cache for WordPress è il plugin gratuito sviluppato da Ergonet srl, azienda di hosting italiana, per migliorare drasticamente le performance di un sito web sviluppato in WordPress, grazie all'ausilio di un sistema di cache di pagina lato server (Cache NGINX oppure Varnish cache).</p><h3>BENEFICI</h3><p>L’utilizzo di un sistema di cache lato server, aumenta le performance del tuo sito in WordPress da un minimo del 30% ad un massimo del 70%. Ricorda che la percentuale di miglioramento dipenderà comunque anche dall’intera strategia di ottimizzazione del tuo sito web.</p><h3>COS’È LA CACHE DI PAGINA E COME FUNZIONA?</h3><p>La cache di pagina velocizza il tuo sito memorizzando l’intero HTML delle pagine web direttamente sul web server, restituendole istantaneamente ai visitatori senza necessità di interrogare nuovamente il server php o il database. In base al piano di hosting acquistato, potrai attivare la cache di pagina NGINX (piano Equilibrio) o la cache di pagina avanzata Varnish su memoria RAM (piani Progresso e Successo).</p><h3>COMPATIBILITÀ</h3><p>Il plugin Ergonet Cache è compatibile con tutti gli altri plugin di cache e ottimizzazione del sito web. Ad esempio WP Rocket, W3 Total cache, WO Optimize, ecc.</p><p>Il plugin Ergonet Cache funziona esclusivamente come layer di comunicazione tra WordPress e il sistema di cache (Varnish oppure NGINX) installato sulla piattaforma server di <b>hosting per WordPress (qualsiasi piano) e cloud hosting dedicati (piani Solo e Multidominio)</b> di Ergonet disponibili per l’acquisto a questo link <a href=\"https://www.ergonet.it/hosting/hosting-wordpress-valore\" target=\"_blank\">https://www.ergonet.it/hosting/hosting-wordpress-valore</a></p><p>Un requisito fondamentale per il funzionamento del plugin è l’attivazione del sistema di cache dal WebPanel (area clienti Ergonet disponibile su <a href=\"https://webpanel.ergonet.it\" target=\"_blank\">https://webpanel.ergonet.it</a>) da parte dell’utente che ha acquistato il servizio di hosting condiviso o cloud dedicato.</p><h3>COME FUNZIONA IL PLUGIN</h3><p>Una volta attivato il sistema di cache dal WebPanel di Ergonet e installato e attivato il plugin Ergonet Cache, lo stesso funzionerà senza alcuna configurazione aggiuntiva.</p><b>Aggiornamento delle risorse in cache</b><p>Ogni volta che il webmaster aggiornerà un articolo o una pagina, il plugin installato in WordPress si occuperà di eliminare la vecchia risorsa presente in cache, per evitare che gli utenti visualizzino un contenuto vecchio.</p><p>Contestualmente verrà anche eliminata la cache della homepage, per aggiornare gli eventuali ultimi articoli disponibili nella stessa.</p><b>Cancellazione delle risorse in cache</b><p>Considerata la funzionalità di aggiornamento e rimozione automatica delle risorse, non sarà necessario cancellare forzatamente la cache per alcun motivo. Inoltre la cancellazione totale della cache è un’azione sconsigliata, in quanto eliminerebbe dalla stessa tutte le risorse (pagine, articoli, ecc) che sono state immagazzinate in precedenza poiché molto visitate.</p><p>Su siti con moltissimi contenuti l’operazione di cancellazione totale della cache potrebbe causare inoltre un rallentamento importante, causato della necessità da parte del sito in WordPress di rigenerare nuovamente da zero tutte le pagine o articoli richieste dagli utenti.</p><h3>COSA NON VIENE INSERITO IN CACHE</h3><p>Per rendere efficiente il funzionamento del plugin, ci sono alcune risorse e chiamate HTTP specifiche che non verranno mai inserite in cache, ecco quali:</p><ul style=\"list-style: disc;padding-inline-start: 40px;\"><li>Qualsiasi pagina, articolo/risorsa visitato da un utente loggato.</li><li>Qualsiasi pagina, articolo/risorsa in cui viene settato un header no-cache e similari.</li><li>Tutte le chiamate dirette al backend di WordPress.</li><li>Tutte le chiamate eseguite per inserimento dati (form di registrazione, contatti, commenti e così via.)</li></ul><h3>COME VERIFICARE CHE LA CACHE VARNISH SIA FUNZIONANTE</h3><p>Il sistema di cache lato server setta degli header HTTP specifici nel caso la risorsa (link) richiamata sia presente o meno in cache. Per verificare se il sito web stia sfruttando la cache correttamente, è quindi necessario verificare la presenza di questi header HTTP.</p><p>È essenziale assicurarsi di essere sloggati dal sito WordPress oggetto della verifica e da qualsiasi altro sito WordPress aperto in una scheda del browser utilizzato. Per prima cosa è quindi assolutamente necessario eseguire un logout dall'area di backend di WordPress.</p><p>Aprire gli strumenti per sviluppatori in base al browser utilizzato:</p><p>Firefox tramite il menù:</p><p>strumenti -> strumenti del browser -> Console del browser</p><p>Chrome tramite il menù: Vista -> opzioni per sviluppatori -> strumenti per sviluppatori</p><p>A questo punto si apriranno gli strumenti per sviluppatori:</p><ul style=\"list-style: disc;padding-inline-start: 40px;\"><li>selezionare la scheda “Rete” oppure “Network”</li><li>selezionare la sotto-scheda “HTML” in Firefox oppure “Doc” in Chrome</li><li>ricaricare il sito web eseguendo un refresh della pagina</li><li>cliccare sulla prima riga, relativa al nome dominio (oppure il link della pagina visitata) identificato con stato o status 200</li></ul><p>Nella colonna di destra si apriranno gli Header di risposta, l’ultimo header sarà quello relativo alla cache:</p><h3>HEADER VARNISH CACHE</h3><p><b>X-VC-Cache: HIT</b>= la risorsa, quindi la pagina richiamata, è presente in cache ed è stata restituita dal sistema di cache Varnish. Significa che il sistema di cache sta funzionando correttamente.</p><p><b>X-VC-Cache: MISS</b>= la risorsa, quindi la pagina richiamata, NON è presente in cache ed è stata generata dall’applicazione WordPress. Significa che il sistema di cache è stato istruito dagli header dell’applicazione oppure da regole personalizzate, a non restituire il contenuto presente in cache al visitatore.</p><h3>HEADER CACHE NGINX</h3><p><b>x-cache-status: HIT oppure STALE</b>= la risorsa, quindi la pagina richiamata, è presente in cache ed è stata restituita dal sistema di cache NGINX. Significa che il sistema di cache sta funzionando correttamente.</p><p><b>x-cache-status: MISS</b>= la risorsa, quindi la pagina richiamata, NON è presente in cache ed è stata generata dall’applicazione WordPress. Significa che il sistema di cache è stato istruito dagli header dell’applicazione oppure da regole personalizzate, a non restituire il contenuto presente in cache al visitatore.</p><h3>ATTIVAZIONE DEL SISTEMA DI CACHE DAL WEBPANEL</h3><p>Il sistema di cache NGINX è attivo di default e non presenta configurazioni particolari da settare.</p><p>Per l'attivazione del sistema di cache Varnish, consigliamo di visionare la guida dedicata <a href=\"https://docs.ergonet.it/gestione-hosting/impostazioni-cache-server/cache-varnish\" target=\"_blank\">https://docs.ergonet.it/gestione-hosting/impostazioni-cache-server/cache-varnish</a></p>"; 62 62 } 63 63 … … 70 70 71 71 jQuery.post(ajaxurl, data, function(response) { 72 jQuery('#wpbody-content').prepend('<div class="notice notice-success is-dismissible"><p>Cancellazione della homepage dalla cache Varnishavvenuta correttamente</p></div><br/>');72 jQuery('#wpbody-content').prepend('<div class="notice notice-success is-dismissible"><p>Cancellazione della homepage dalla cache avvenuta correttamente</p></div><br/>'); 73 73 }); 74 74 }); … … 80 80 81 81 jQuery.post(ajaxurl, data, function(response) { 82 jQuery('#wpbody-content').prepend('<div class="notice notice-success is-dismissible"><p>Cancellazione dell\'intera cache Varnishavvenuta correttamente</p></div><br/>');82 jQuery('#wpbody-content').prepend('<div class="notice notice-success is-dismissible"><p>Cancellazione dell\'intera cache avvenuta correttamente</p></div><br/>'); 83 83 }); 84 84 }); … … 98 98 function adminBarMenu($wp_admin_bar) { 99 99 global $pagenow; 100 $wp_admin_bar->add_node(array("id"=>"parent_node_1", "title"=>"<span class=\"ab-icon dashicons dashicons-performance\"></span>Ergonet VarnishCache", "href"=>false));100 $wp_admin_bar->add_node(array("id"=>"parent_node_1", "title"=>"<span class=\"ab-icon dashicons dashicons-performance\"></span>Ergonet Cache", "href"=>false)); 101 101 $wp_admin_bar->add_group(array("id"=>"group_1", "parent"=>"parent_node_1")); 102 102 $wp_admin_bar->add_group(array("id"=>"group_2", "parent"=>"parent_node_1")); 103 103 104 104 $wp_admin_bar->add_node(array("id"=>"cache-purge-homepage", "title"=>"Aggiorna cache homepage", "href"=>"#", "parent"=>"group_1")); 105 $wp_admin_bar->add_node(array("id"=>"cache-purge-all", "title"=>"Svuota tutta la cache Varnish", "href"=>"#", "parent"=>"group_1"));105 $wp_admin_bar->add_node(array("id"=>"cache-purge-all", "title"=>"Svuota tutta la cache", "href"=>"#", "parent"=>"group_1")); 106 106 $wp_admin_bar->add_node(array("id"=>"child_node_4", "title"=>"Informazioni sul plugin", "href"=>admin_url('admin.php?page=varnishCacheInfo'), "parent"=>"group_2")); 107 107 }
Note: See TracChangeset
for help on using the changeset viewer.