Woocommerce and EasyEngine


#1

I just want to make sure there is no additional configuration options rtCamp suggests when using easy engine and woocommerce. Is there, or does it work out of the box?


How can we scale better?
Officially supported woocommerce wpfc config (please)
#2

Hi, Which caching mechanism you are using for your site with EasyEngine? If you are using fastcgi caching then this our tutorial will help you:


#3

Hi Yes, Fastcg is what I am using with EE install. So to be clear, it sounds like you are saying edits to wpfc.conf are required (or highly suggested), even if we use EE. But the file says

# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee)

So what is the suggested way to implement these tweaks with an EE install?

# Woocommerce Tweaks
if ($request_uri ~* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") {
    set $skip_cache 1;
}
if ( $arg_add-to-cart != "" ) { 
    set $skip_cache 1;
}
if ( $cookie_woocommerce_items_in_cart != "0" ) {	
    set $skip_cache 1;
}

Where do we put that? And should we modify the php location with

set $rt_session "";

	if ($http_cookie ~* "wc_session_cookie_[^=]*=([^%]+)%7C") {
           		set $rt_session wc_session_cookie_$1;
   		}	

	if ($skip_cache = 0 ) {
		more_clear_headers "Set-Cookie*";
		set $rt_session "";
	}

        fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";

#4

@datagroove

instead of modify the wpfc.conf file copy it to wpfc-woocommerce.conf

cp -av /etc/nginx/common/wpfc.conf  /etc/nginx/common/wpfc-woocommerce.conf

Now modify what ever you want in wpfc-woocommerce.conf file and include that file.

In this way all your custom changes is not overwrite in future.

Let me know if you have any other question.


#5

@miteshshah

thanks, I changed the include in the vhosts config file from include common/wpfc.conf; to include common/wpfc-woocommerce.conf; And my wpfc-woocommerce.conf file has been edited to include the suggestions from the linked tutorial, can you confirm this looks good:

BELOW WAS ADDED after set $skip_cache 0'

# Woocommerce Tweaks
if ($request_uri ~* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") {
    set $skip_cache 1;
}
if ( $arg_add-to-cart != "" ) { 
    set $skip_cache 1;
}
if ( $cookie_woocommerce_items_in_cart != "0" ) {   
    set $skip_cache 1;
}

also, I have to take a look at the suggestion to replace/add to location ~ \.php$


#6

@datagroove that tutorial has some outdated information on it for running woocommerce. I had a short email discussion with @rahul286 about it and i know he is planning to update that tutorial soon. In the mean time, you might want to look at this: https://gist.github.com/rahul286/dc64ae84c97868b862c4 make sure to read through the comments as well.

here are the relevant sections of my current woocommerce config:

# woocommerce stuff
if ($request_uri ~* "/cart.*|/my-account.*|/checkout.*|/addons.*") {
  set $skip_cache 1;
}

location ~ \.php$ {
  set $rt_session "";

  if ($http_cookie ~* "wp_woocommerce_session_[^=]*=([^%]+)%7C") {
    set $rt_session wp_woocommerce_session_$1;
  }

  if ($skip_cache = 0 ) {
    more_clear_headers "Set-Cookie*";
    set $rt_session "";
  }

  fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";

  try_files $uri =404;
  include fastcgi_params;
  fastcgi_pass $backend;

  fastcgi_cache_bypass $skip_cache;
  fastcgi_no_cache $skip_cache;

  fastcgi_cache WORDPRESS;
}

notes

  • i didn’t find it necessary to skip caching /store.*.
  • You might also want to think about using that directive that turns off caching whenever there is anything in the cart (which rahul changed in the gist from != "0" to = "1"). That makes your cache stop working altogether for anyone who has anything in their cart, no matter where they go on your site. That may or may not be what you want.

#7

Hi @datagroove

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile:


#8