3

Installed the latest Magento 2 beta3 release with sample data, and configured Varnish, and enabled Varnish debugging in vcl file. When requesting a page, and refreshing, I see the css, js files, etc... are all cached (showing HIT) but the response headers for the magento pages show:

Referer:http://xxx/magento2/men/tops-men/tees-men.html
    Via:1.1 varnish
    X-Magento-Cache-Control:no-store, no-cache, must-revalidate, max-age=0
    X-Magento-Cache-Debug:MISS
    X-Varnish:1005693536

I have Varnish enabled in the admin panel (Full Page Cache set to "Varnish Caching") and the generated vcl loaded into Varnish.

Is this the expected result for the Magento pages themselves? Should I see a "HIT" for the Magento page in Varnish? Just trying to better understand how it works and how best to configure it.

  • ok, I reset varnish, changed caching to built-in, made sure FPC cache was enabled and flushed, then set back to varnish caching mode, saved, and now seeing cache hits on pages. May have been bug or just a weird saved state. – Rob Mangiafico Jan 10 '15 at 21:04
6

The answer I found is, Yes, a Varnish HIT should be recorded for cached pages in Magento 2 when Varnish is properly enabled. By properly, I mean:

  • Varnish installed and running
  • Magento 2 configured to use Varnish as FPC (Stores -> Configuration -> System -> "Full Page Cache"
  • Download the vcl Magento gives you in the above admin area and load it into Varnish.
  • Make sure that the "Page Cache" under System -> Cache Management is also enabled and refreshed.

To see the HIT in the HTTP response headers, you need to edit the vcl file and comment out the line:

unset resp.http.X-Varnish;

For Debug lines in the header response, put Magento into Developer mode, and make sure the resp.http.X-Magento-Debug is set (or unset commented out).

-2

Step 1-: Install required packages

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ondrej/mysql-5.6
$ sudo add-apt-repository -y ppa:ondrej/php5-5.6
$ sudo apt-add-repository -y ppa:duggan/composer
$ sudo apt-get update
$ sudo apt-get install -y php5-fpm nginx varnish php5-gd php5-intl php5-mcrypt php5-xsl mysql-server php5-curl php5-json php5-composer
$ sudo php5enmod mcrypt

Step 2-: Create a database to install magento2.

mysql -p -e "create database magento2"

Step 3-: Varnish server setup.

sudo nano /etc/default/varnish

Default configuration replace from

DAEMON_OPTS="-a :6081 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"

To

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,1024m"

Check default.vcl file port

nano /etc/varnish/default.vcl

Output-:

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

Configure the nginx.conf to listen port 8080.

  • Welcome to Magento SE! Please attempt to limit the amount of self-referencing you do on this site. You're getting flagged for spam quite a bit. – philwinkle Apr 27 '16 at 20:08

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.