GithubHelp home page GithubHelp logo

nttan / docker-magento2-varnish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zengoma/docker-magento2-varnish

0.0 1.0 0.0 3 KB

A simple varnish 4 cache for Magento 2

Perl 90.39% Shell 9.61%

docker-magento2-varnish's Introduction

Magento 2 Varnish4 Cache

A simple varnish 4 cache for Magento 2. This varnish cache works well with my magento2 dev container.

Using the cache

Minimal setup only requires that you bind port 80 to the host and that you name your magento2 container "magento2" or link it to magento2 in the varnish container.

docker-compose example:

version: "3"
services:

  varnish:
    depends_on:
      - magento2-dev
    image: magento2-varnish
    ports:
      - "80:80"
    links:
      - magento2-dev:magento2

  # Your magento 2 container goes here

Configure Magento 2 to use Varnish4

The following steps are required to ensure magento can use and purge the varnish cache:

  • Log in to the Magento Admin as an administrator.
  • Click STORES > Configuration > ADVANCED > System > Full Page Cache.
  • From the Caching Application list, click Varnish Caching.
  • Enter a value in the TTL for public content field.
  • You do not need to fill in or export any configuration details.

Alternatively you can run the following command on your database container to enable the cache:

docker-compose exec db sh mysqld -u $MYSQL_USER -p"${MYSQL_PASSWORD}" -D $MYSQL_DATABASE -e \
"INSERT INTO core_config_data ( scope, scope_id, path, value ) VALUES \
( 'default', '0', 'system/full_page_cache/caching_application', '2') \
ON DUPLICATE KEY UPDATE value = 2;"

Where "db" is the name of the database container

Default variables

  • VARNISH_PORT 80
  • VARNISH_BACKEND 80

There are only two configurable variables, there is no need to really change these unless you have configured magento to listen on a different port or you want to serve varnish content on a port other than 80.

docker-magento2-varnish's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.