How To Install Varnish Cache On AmazonLinux2 And Integrate With WordPress ?iam.awslagi
In this post we will show you How To Install Varnish Cache On AmazonLinux2 and integrate with WordPress step by step.
VE is the commercial enterprise version of the open-source HTTP engine and reverse HTTP proxy, Varnish Cache (VC). VE provides usability improvements and performance enhancements over VC. Both versions of Varnish speed up a website by caching (storing) a copy of a page served by your web server the first time a user visits your page. The next time the user requests the same page, the cache will serve the copy quickly, instead of requesting the page from the web server again. Varnish delivers your web content 300% to 1000% faster, with a reduction of backend server load of up to 89% while handling large numbers of simultaneous visitors, depending on your architecture.
VE provides usability improvements and performance enhancements over VC. It also includes:
- Massive Storage Engine (MSE), a file backend for large datasets designed specifically for the high-performance needs of video distribution, content delivery networks (CDNs), and large cache use cases. MSE provides persistence caching to ensure that your Varnish caching layer can handle multi-terabyte datasets and persist them across sessions so that in the event of an outage or restart, you can avoid the time-consuming wait for the data or content to repopulate.
- Varnish High Availability (VHA), a high-performance content replicator that helps ensure that your content is available and accessible 24/7 across a global distribution of servers. VHA ensures up time for business-critical websites and applications, and maximizes performance by helping to eliminate cache misses and protecting back-end infrastructure from overload if the cache fails.
- SSL/TLS support on both the server and client. The Secure Sockets Layer / Transport Layer Security (SSL/TLS) proxy is tightly integrated with Varnish and helps improve website security by encrypting communications without relying on third-party solutions. SSL/TLS support is provided both as client-facing TLS and on the backend, to provide a minimalistic and fast TLS proxy.
1. Install Varnish on AmazonLinux2:
amazon-linux-extras install epel yum install varnish -y
2. Start Varnish
service varnish start
Check Varnish version
3. Integrate with WordPress.
Log in to your WordPress administration page at http://www.example.com/wp-admin using the username and password you configured.
- Select Plugins
- Add New from the left sidebar menu
- Search for Varnish plugins
- Choose plugin
- Click on Add Plugin
- After the plugin is added, activate plugin
If you search at WordPress.org for plugins like this:
you will be presented with a lot of plugins containing the tag Varnish. But do not get lost. We have looked through the plugins and below you will find the most popular ones with a short description.
The most recommended plugins include:
Varnish HTTP Purge:
Varnish HTTP purge sends a PURGE request to the URL of a page or post every time it it modified. This occurs when editing, publishing, commenting or deleting an item, and when changing themes. Not all pages are purged every time, depending on your Varnish configuration. Read more on the link.
W3 Total Cache:
W3 total cache improves the user experience of your site by increasing server performance, reducing the download times and providing transparent content delivery network (CDN) integration. Read more on the plugins page.
The plugin was developed to optimize the WordPress deployment on varnish + nginx + php-fpm + php-apc server stack using three type of caches full page cache, db cache and opcode cache. They also support Varnish cache management with given default.vcl. Read more on the plugins page.
In next post we will show you how to deploy varnish on AWS with high availability. You can reference figure below.