fastcgi_cache and Woocomerce


in this statement

if ( $arg_add-to-cart != "" ) {   
      set $skip_cache 1;  

are those

I think that might lead to confusion… just making sure I copy/paste correct stuff


It’s font’s rendering issue/side-effect.

Codes have correct version of "

Also, if you paste inverted quotes, nginx -t will fail.

If you are using ee site edit command, pasting anything wrong will fail nginx config test, which will prevent nginx from reloading config (hence saving from crash).


THX, was just making sure I’ve got it right :wink:


Btw. how would I check that these WC rules now work? Obviously I can’t check the headers with curl anymore since I can’T simulate adding an item to my cart with curl I reckon…


I’ve got a bit of a problem:

my original setup has these:

        location ~ \.php$ {  
            try_files  @php;  
        location @php {  
            try_files $uri =404;  
            include /etc/nginx/fastcgi_params;  
            fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;  
            fastcgi_index index.php;  
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
            fastcgi_intercept_errors on;  
            fastcgi_buffer_size 128k;  
            fastcgi_buffers 256 16k;  
            fastcgi_busy_buffers_size 256k;  
            fastcgi_temp_file_write_size 256k;  
            fastcgi_read_timeout 3000;  
            fastcgi_cache_bypass $skip_cache;  
            fastcgi_no_cache $skip_cache;  
            fastcgi_cache WORDPRESS;  
            fastcgi_cache_valid  60m;  

BUT if I replace

        location ~ \.php$ {  
            try_files  @php;  


location ~ \.php$ {  
	 	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";  

		try_files $uri =404;

my browser downloads files instead of parsing PHP.

Any ideas how I can fix this?