This blog is built with Grav CMS and it starts very slow with basic installation, so it is necessary to make a few configuration changes for speed.

Grav CMS documentation:

PHP Requirements

Most hosting providers and even local LAMP setups have PHP pre-configured with everything you need for Grav to run 'out-of-the-box'. However, some Windows setups, and even Linux distributions local or on VPS (I'm looking at you Debian!) - ship with a very minimal PHP compile. Therefore, you may need to install or enable these PHP modules:

curl (client for URL handling used by GPM)
ctype (used by symfony/yaml/Inline)
dom (used by grav/admin newsfeed)
gd (a graphics library used to manipulate images)
json (used by Symfony/Composer/GPM)
mbstring (multibyte string support)
openssl (secure sockets library used by GPM)
session (used by toolbox)
simplexml (used by grav/admin newsfeed)
xml (XML support)
zip extension support (used by GPM)

For enabling openssl and (un)zip support you will need to find in the php.ini file of your Linux distribution for lines like:

; ;

and remove the leading semicolon. Optional Modules

apcu for increased cache performance
opcache for increased PHP performance
yaml PECL Yaml provides native yaml processing and can dramatically increase performance
xdebug useful for debugging in a development environment

Caching Options

Caching is an integral feature of Grav that has been baked in from the start. The caching mechanism that Grav employs is the primary reason Grav is as fast as it is. That said, there are some factors to take into account.

Grav uses the established and well-respected Doctrine Cache library. This means that Grav supports any caching mechanism that Doctrine Cache supports. This means that Grav supports:

Auto (Default) - Finds the best option automatically
File - Stores in cache files in the cache/ folder
APCu -
Memcache -
Redis -
WinCache -

By default, Grav comes preconfigured to use the auto setting. This will try APC, then WinCache, and lastly File. You can, of course, explicitly configure the cache in your user/config/system.yaml file, which could make things ever so slightly faster.




Config options for speed:

I assumed that Grav’s default settings would optimize the HTML, CSS and JS generated by the templates and plugins, but in my case, I had to enable a few settings in the Grav Configuration page:

Under Caching > enable Gzip compression
User Assets > enable CSS pipeline and JavaScript pipeline - which according to Grav Documentation, merges multiple CSS and JS files together.

After any changes, remember to head back to the Grav Dashboard and Clear Cache. Then, reload the page in a New Private Window or clear your web browser cache to see the changes take effect.

Source: Grav CMS optimization blog

Previous Post Next Post