Configuring Varnish tutorial

Sara7

Well-known member
Trusted Uploader
Aug 13, 2019
365
470
70
From many different places
Badly I don't have any live experience with varnish , could suggest your google results - but I don't let other's shoot arrows towards unpredictable success rate :)
Thank you for your reply.
I've installed Bitnami wordpress with nginx and sss stack on my linux localhost because I thought it will be easier to conigure the stack. Sadly, there is no online tutorial for configuring that stack with varnish cache on localhost.
I had to delete Bitnami stack and I installed LEMP stack separately.
 

jancok

Active member
Oct 6, 2019
154
99
43
Graveyard
www.presidenri.go.id
Thank you for your reply.
I've installed Bitnami wordpress with nginx and sss stack on my linux localhost because I thought it will be easier to conigure the stack. Sadly, there is no online tutorial for configuring that stack with varnish cache on localhost.
I had to delete Bitnami stack and I installed LEMP stack separately.

You can try pre-configured stack like slickstack or easyengine. These stacks handle server config, security, performance, so you can focus on development.
 
  • Like
Reactions: Sara7

Sara7

Well-known member
Trusted Uploader
Aug 13, 2019
365
470
70
From many different places
Here it is if you still need it... varnish-nginx-wordpress vcl
And more if you want to dive into it Varnish Configs
By the way Bitnami way for varnish Configuring Varnish in Bitnami

Thank you @ckeeper for your tips.

Unfortunately, as you can see on provided link Configuring Varnish in Bitnami, this is configuration only for Apache.

Luckily, I gave up from Bitnami. I installed LEMP without any pre-configured stack. Varnish works fine, except woocommerce pages.
 

jancok

Active member
Oct 6, 2019
154
99
43
Graveyard
www.presidenri.go.id
Thank you @ckeeper for your tips.

Unfortunately, as you can see on provided link Configuring Varnish in Bitnami, this is configuration only for Apache.

Luckily, I gave up from Bitnami. I installed LEMP without any pre-configured stack. Varnish works fine, except woocommerce pages.
You have to exclude woo pages from varnish. Here's from the official woocommerce page https://docs.woocommerce.com/document/configuring-caching-plugins/#section-5

I use varnish on my woocommerce sites, I excluded these pages and cookies:
Page:
cart
my-account
checkout
addons
\?add-to-cart=
add-to-cart

Cookies:
woocommerce_cart_hash
woocommerce_items_in_cart
wp_woocommerce_session_
 
  • Like
Reactions: Sara7 and tikona6

tikona6

Member
Aug 1, 2019
87
43
18
I did the same when I was with EIG hosting. They still provide Varnish Caching with their plans.
 

ckeeper

Well-known member
Nov 8, 2019
623
376
63
You have to exclude woo pages from varnish. Here's from the official woocommerce page https://docs.woocommerce.com/document/configuring-caching-plugins/#section-5

I use varnish on my woocommerce sites, I excluded these pages and cookies:
Page:
cart
my-account
checkout
addons
\?add-to-cart=
add-to-cart

Cookies:
woocommerce_cart_hash
woocommerce_items_in_cart
wp_woocommerce_session_

Above information is correct but be careful when using it with cache extensions like WP Rocket, W3T etc, some of this is automatically handled. It is more of a fine tuning really.
 
  • Like
Reactions: Sara7

ckeeper

Well-known member
Nov 8, 2019
623
376
63
Thank you @ckeeper for your tips.

Unfortunately, as you can see on provided link Configuring Varnish in Bitnami, this is configuration only for Apache.

Luckily, I gave up from Bitnami. I installed LEMP without any pre-configured stack. Varnish works fine, except woocommerce pages.

Compare your varnish.vcl (usually under /etc/varnish/varnish.vcl) with the following one optimized for woocommerce and nginx Varnish Config file for wordpress+woocommerce+nginx .What kind of problems are you still having with it?
 
  • Like
Reactions: Sara7

ckeeper

Well-known member
Nov 8, 2019
623
376
63
Thank you @ckeeper for your tips.

Unfortunately, as you can see on provided link Configuring Varnish in Bitnami, this is configuration only for Apache.

Luckily, I gave up from Bitnami. I installed LEMP without any pre-configured stack. Varnish works fine, except woocommerce pages.
Hey Sara, I have tested bitnami Nginx stack with PHP and MySQL (LEMP) on my virtualbox, under the stack directory there is varnish, all the procedures I have posted for apache is same for the nginx version to activate Varnish. I hope this has cleared up your issue.

Code:
sudo mv installdir/varnish/scripts/ctl.sh.disabled installdir/varnish/scripts/ctl.sh
sudo installdir/ctlscript.sh start varnish

25033
 

Forum statistics

Threads
69,477
Messages
909,882
Members
239,664
Latest member
شاكر

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu