I have configured Varnish cache in the local Magento 2 environment and It is working fine.
I have added the below lines in the app/etc/env.php
file.
'http_cache_hosts' => [
[
'host' => '127.0.0.1',
'port' => '6082'
]
]
What is the real purpose of adding this configuration in Magento 2 env.php
?
What do these configurations do?
How it affects Magento? Please Help me Out….
Best Answer
To make Magento aware of the Varnish servers, add the following section to
app/etc/env.php
. For Example:In order to ensure the Varnish cache can be cleared, you must also add a node to your
env.php
to tell Magento how to communicate with VarnishI hope this will help