Skip to content

Instantly share code, notes, and snippets.

@jmsmrgn
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmsmrgn/9b88a8d79a681218af7d to your computer and use it in GitHub Desktop.
Save jmsmrgn/9b88a8d79a681218af7d to your computer and use it in GitHub Desktop.
W3TC Errors
Edit file /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/nginx.conf and add the following rules above the WordPress directives:
# BEGIN W3TC Page Cache core
set $w3tc_rewrite 1;
if ($request_method = POST) {
set $w3tc_rewrite 0;
}
if ($query_string != "") {
set $w3tc_rewrite 0;
}
if ($request_uri !~ \/$) {
set $w3tc_rewrite 0;
}
if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
set $w3tc_rewrite 0;
}
if ($http_cookie ~* "(w3tc_preview)") {
set $w3tc_rewrite _preview;
}
set $w3tc_enc "";
if ($http_accept_encoding ~ gzip) {
set $w3tc_enc _gzip;
}
if (!-f "$document_root/wp/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite.html$w3tc_enc") {
set $w3tc_rewrite 0;
}
if ($w3tc_rewrite = 1) {
rewrite .* "/wp/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite.html$w3tc_enc" last;
}
# END W3TC Page Cache core
Edit file /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/nginx.conf and add the following rules above the WordPress directives:
# BEGIN W3TC Page Cache cache
location ~ /wp/wp-content/cache/page_enhanced.*html$ {
add_header Vary "Accept-Encoding, Cookie";
}
location ~ /wp/wp-content/cache/page_enhanced.*gzip$ {
gzip off;
types {}
default_type text/html;
add_header Vary "Accept-Encoding, Cookie";
add_header Content-Encoding gzip;
}
# END W3TC Page Cache cache
Edit file /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/nginx.conf and add the following rules above the WordPress directives:
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
# END W3TC Browser Cache
Execute next commands in a shell:
cp /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/wp/wp-content/plugins/w3-total-cache/wp-content/object-cache.php /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/wp/wp-content/object-cache.php
cp /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/wp/wp-content/plugins/w3-total-cache/wp-content/db.php /mnt/sofiweb/deploy/sofi-web/releases/20140529180905/web/wp/wp-content/db.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment