3

I installed Varnish, but getting this message. Varnish cache not working. And check the var/page_cache/ directory is not empty.still have mage-tags file.

i have in System > Full Page Cache > Setting > 
Access list:11.22.133.44
Backend host:11.22.133.44
Backend port:80
Grace period:300. 
My whm setting Apache IP/port:8080. 

My /etc/varnish/varnish.params

# Varnish environment configuration description. This was derived from
# the old style sysconfig/defaults settings

# Set this to 1 to make systemd reload try to switch VCL without restart.
RELOAD_VCL=1

# Main configuration file. You probably want to change it.
VARNISH_VCL_CONF=/etc/varnish/default.vcl

# Default address and port to bind to. Blank address means all IPv4
# and IPv6 interfaces, otherwise specify a host name, an IPv4 dotted
# quad, or an IPv6 address in brackets.
VARNISH_LISTEN_ADDRESS=11.22.133.44
VARNISH_LISTEN_PORT=80

# Admin interface listen address and port
VARNISH_ADMIN_LISTEN_ADDRESS=11.22.133.44
VARNISH_ADMIN_LISTEN_PORT=6082

# Shared secret file for admin interface
VARNISH_SECRET_FILE=/etc/varnish/secret

# Backend storage specification, see Storage Types in the varnishd(5)
# man page for details.
VARNISH_STORAGE="malloc,4096M"

# User and group for the varnishd worker processes
VARNISH_USER=varnish
VARNISH_GROUP=varnish

# Other options, see the man page varnishd(1)
DAEMON_OPTS="-a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,4096m -p thread_pool_min=5 -p thread_pool_max=500 -p thread_pool_tim$$ol_timeout=300"

my /etc/varnish/default.vcl is follow this file: https://gist.github.com/dvershinin/de91aa78a96ae9f6e8d2950b3e1463a4

backend default {
    .host = "11.22.133.44";
    .port = "8080";
}

acl purge {
    "11.22.133.44";
}

please help. thank you very much~

curl -I -v --location-trusted 'http://demo.xxx.com'
* About to connect() to demo.xxx.com port 80 (#0)
*   Trying 11.22.133.44...
* Connected to demo.xxx.com (11.22.133.44) port 80 (#0)
> HEAD / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: demo.xxx.com
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 22 Oct 2018 09:06:53 GMT
Date: Mon, 22 Oct 2018 09:06:53 GMT
< Pragma: no-cache
Pragma: no-cache
< Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Cache-Control: max-age=0, must-revalidate, no-cache, no-store
< Expires: Sun, 22 Oct 2017 09:06:53 GMT
Expires: Sun, 22 Oct 2017 09:06:53 GMT
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Set-Cookie: PHPSESSID=bcf54440a844d3de2256cb07e54c268a; expires=Mon, 22-Oct-2018 10:06:53 GMT; Max-Age=3600; path=/; domain=demo.xxx.com; HttpOnly
Set-Cookie: PHPSESSID=bcf54440a844d3de2256cb07e54c268a; expires=Mon, 22-Oct-2018 10:06:53 GMT; Max-Age=3600; path=/; domain=demo.xxx.com; HttpOnly
< X-UA-Compatible: IE=edge
X-UA-Compatible: IE=edge
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< X-Host: demo.xxx.com
X-Host: demo.xxx.com
< X-Magento-Cache-Control: max-age=0, must-revalidate, no-cache, no-store
X-Magento-Cache-Control: max-age=0, must-revalidate, no-cache, no-store
< Content-Encoding: gzip
Content-Encoding: gzip
< Vary: Accept-Encoding
Vary: Accept-Encoding
< Age: 0
Age: 0
< X-Magento-Cache-Debug: MISS
X-Magento-Cache-Debug: MISS
< Connection: keep-alive
Connection: keep-alive

<
* Connection #0 to host demo.xxx.com left intact
  • some one can help?please – niceonelee Oct 22 '18 at 9:32
  • Have you "told" Magento to make use of Varnish? This is done in admin, somewhere in System settings you have to choose Varnish FPC, and enable all caches. – Danila Vershinin Oct 22 '18 at 13:50
  • i have in System > Full Page Cache > Setting > Access list:11.22.133.44 , Backend host:11.22.133.44, Backend port:80, Grace period:300. My whm setting Apache IP/port:8080. Can you tell me what wrong?please @DanielV. – niceonelee Oct 22 '18 at 17:08
  • i updated in original post,pleae check, thank you! @DanielV. – niceonelee Oct 22 '18 at 17:14
  • In Magento settings, the backend port setting should be 8080 (where your Apache listens, not Varnish). Make sure to clear all caches after saving settings. Best is install and use n98-magerun, e.g. n98-magerun2 cache:flush – Danila Vershinin Oct 22 '18 at 17:32
7

First, make sure you have caching enabled

bin/magento cache:status

Next, try to load some public page (for example the homepage) directly from apache or whichever server you're using, before varnish. In your case, it's on port 8080. Look for header Cache-Control. It must say smth like this for Varnish to work properly:

Cache-Control: max-age=86400, public, s-maxage=86400

Instead, of you see smth like

Cache-Control: max-age=0, must-revalidate, no-cache, no-store

then, probably, there's some block on the page that is not cacheable. In such a case, look for cacheable="false" in *.xml files and consider making the blocks cacheable.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.