Stratus Guides - Using Varnish
Enable Varnish for Magento 2
To enable Varnish on your store, follow these steps:
- Log into your Magento 2 admin panel.
- Connect to your store admin panel and go to Stores → Settings → Configuration → Advanced → System → Full Page Cache
- In the FPC section, configure it as in the screenshot below
- Save the configuration
- Now log into your STRATUS Store Panel
- Go to the Varnish area from the left-hand navigation menu, click to expand and select the Info section.
- Click Enable to start the Varnish service. (Note: this will redeploy all services)
- Varnish is now enabled!
Enable Varnish with Turpentine
If you are using Magento 1 and Turpentine, the configuration for Turpentine should use:
- 127.0.0.1 for the backend host
Then
- Log into your STRATUS Store Panel
- Go to the Varnish area from the left-hand navigation menu, click to expand and select the **Info **section.
- Click Enable to start the Varnish service.
- Varnish is now enabled!
Using a Custom VCL
You can add a custom VCL under Varnish->VCL. It will cause a redeploy of services once applied. You can view the default VCL used under Varnish->Info. Please note that you must use the following acl purge block for purge to work correctly.
acl purge {
"127.0.0.1";
"192.168.0.0/16";
"10.0.0.0/8";
}
Purging Varnish On STRATUS
Curl works if you are using SSH, the difference is the Varnish hostname is varnish
curl -X 'PURGE' -H'X-Magento-Tags-Pattern: .*' varnish
Varnish also clears with the STRATUS cache.varnish.clear or cache.all.clear commands via SSH.
/usr/share/stratus/cli cache.varnish.clear
/usr/share/stratus/cli cache.all.clear
Magento 2 users should set their http-cache-host accordingly:
php bin/magento setup:config:set --http-cache-hosts=varnish
Feedback
Was this page helpful?
Glad to hear it! Have any more feedback? Please share it here.
Sorry to hear that. Have any more feedback? Please share it here.