Enable Full Page Cache in Magento 2

0
1578
Enable Full Page Cache in Magento 2
Enable Full Page Cache in Magento 2

By default, Full Page Cache (FPC) is disabled after installation, and there is no way to configure it via admin. In this post, I will show you how to enable Full Page Cache in Magento 2.

In order to enable Full Page Cache in Magento 2, you will need to edit app/etc/env.php file in your project, look up the cache_types key and its children:

'cache_types' =>
    array (
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'full_page' => 0,
        'translate' => 1,
        'config_integration' => 1,
        'config_webservice' => 1,
        'config_integration_api' => 1,
    ),
);

Notice the child key full_page, it is the config key to enable or disable the Full Page Cache in Magento 2.

So, we only need to change value to 1 to enable it.

'cache_types' =>
    array (
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'full_page' => 1,
        'translate' => 1,
        'config_integration' => 1,
        'config_webservice' => 1,
        'config_integration_api' => 1,
    ),
);

After that, make sure to execute the cache clear command:

$ bin/magento cache:clear

Now, go to Admin and access the following path, from sidebar select Stores > Configuration, from left panel, scroll down to Advanced section and select System. Take a look at the right panel and scroll down to Full Page Cache section.

Configure Full Page Cache (FPC) in Magento 2
Configure Full Page Cache (FPC) in Magento 2

As you enable the FPC option, it should not be disabled, and you can select the cache option you want to configure for your Magento 2 site.

Have fun!