JonManness
Forum Replies Created
-
Thanks, RavanH! Before we close this out, eShop works after removing the ? in the rewrite rule. You’re a genius! Wanted to share in case you ever need to use eShop on an Nginx server.
Just decided to deactivate eShop and switch to Easy Digital Download, which does work with my config and is better suited with my digital-download-only music.
Ah shoot…just noticed that eShop fails to redirect to PayPal and complete the order. Didn’t work when turning off W3TC, either…probably another Nginx config issue. The plugin works as expected (widget and everything) until I get to shopping-cart/checkout?eshopaction=redirect
Have you ever experienced this? (Sidenote: we totally hijacked your own forum talking about Nginx and eShop…hahaha)
Regular WP installation. W3-TC has always worked great on a shared host and now works even better on a VPS with APC installed. For eshop pages (shopping cart, checkout, etc.), I set it so W3-TC doesn’t cache in order to avoid errors.
I tried commenting out the bootstrap rule, but then my permalinks stopped working. Wish I understood the config rules better so I could keep tweaking, but everything on the front-end works great for now, which is good enough for me 🙂
Thank you the explanation, RavanH. My config has changed since what I posted above…here’s an updated one (removing my domain as well as root and log paths). You’ll notice that the bootstrap rule is after the W3-TC settings like you recommended.
server { # Redirect yoursite.com to www.yoursite.com listen 80; server_name yoursite.com; rewrite ^(.*) http://www.yoursite.com$1 permanent; } server { # Tell nginx to handle requests for the www.yoursite.com domain listen 80; server_name www.yoursite.com; index index.php index.html index.htm; root [path to public html folder] access_log [path to access.log] error_log [path to error.log] # Use gzip compression #deferring to W3-TC settings below # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module # gzip on; #gzip_disable "msie6"; #gzip_vary on; #gzip_proxied any; #gzip_comp_level 5; #gzip_buffers 16 8k; #gzip_http_version 1.0; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml appl$ # Set a variable to work around the lack of nested conditionals set $cache_uri $request_uri; # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $cache_uri 'no cache'; } if ($query_string != "") { set $cache_uri 'no cache'; } # Don't cache uris containing the following segments if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp$ set $cache_uri "no cache"; } # Don't use the cache for logged in users or recent commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") { set $cache_uri 'no cache'; } # Deny access to hidden files location ~* /\.ht { deny all; access_log off; log_not_found off; } # BEGIN W3TC Minify cache location ~ /wp-content/w3tc/min.*\.js$ { types {} default_type application/x-javascript; expires modified 31536000s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding"; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; } location ~ /wp-content/w3tc/min.*\.css$ { types {} default_type text/css; expires modified 31536000s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding"; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; } location ~ /wp-content/w3tc/min.*js\.gzip$ { gzip off; types {} default_type application/x-javascript; expires modified 31536000s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding"; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; add_header Content-Encoding gzip; } location ~ /wp-content/w3tc/min.*css\.gzip$ { gzip off; types {} default_type text/css; expires modified 31536000s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding"; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; add_header Content-Encoding gzip; } # END W3TC Minify cache # BEGIN W3TC Page Cache cache location ~ /wp-content/w3tc/pgcache.*html$ { expires modified 3600s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding, Cookie"; add_header Pragma "public"; add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate"; } location ~ /wp-content/w3tc/pgcache.*gzip$ { gzip off; types {} default_type text/html; expires modified 3600s; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; add_header Vary "Accept-Encoding, Cookie"; add_header Pragma "public"; add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate"; add_header Content-Encoding gzip; } # END W3TC Page Cache cache # BEGIN W3TC Browser Cache gzip on; gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xs$ location ~ \.(css|js|htc)$ { expires 31536000s; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; } location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ { expires 3600s; add_header Pragma "public"; add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate"; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; } location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|q$ expires 31536000s; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; add_header X-Powered-By "W3 Total Cache/0.9.2.4"; } # END W3TC Browser Cache # BEGIN W3TC Minify core rewrite ^/wp-content/w3tc/min/w3tc_rewrite_test$ /wp-content/w3tc/min/index.php?w3tc_rewrite_test=1 last; rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last; # END W3TC Minify core # BEGIN W3TC Page Cache core rewrite ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 last; set $w3tc_rewrite 1; if ($request_method = POST) { set $w3tc_rewrite 0; } if ($query_string != "") { set $w3tc_rewrite 0; } if ($http_host != "www.yoursite.com") { set $w3tc_rewrite 0; } set $w3tc_rewrite3 1; if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.p$ set $w3tc_rewrite3 0; } if ($request_uri ~* "(wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") { set $w3tc_rewrite3 1; } if ($w3tc_rewrite3 != 1) { set $w3tc_rewrite 0; } if ($http_cookie ~* "(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in)") { set $w3tc_rewrite 0; } if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.2\.4)") { set $w3tc_rewrite 0; } set $w3tc_ua ""; set $w3tc_ref ""; set $w3tc_ssl ""; if ($scheme = https) { set $w3tc_ssl _ssl; } set $w3tc_enc ""; if ($http_accept_encoding ~ gzip) { set $w3tc_enc _gzip; } set $w3tc_ext ""; if (-f "$document_root/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl.html$w3tc_enc") { set $w3tc_ext .html; } if ($w3tc_ext = "") { set $w3tc_rewrite 0; } if ($w3tc_rewrite = 1) { rewrite .* "/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl$w3tc_ext$w3tc_enc" last; } # END W3TC Page Cache core # unless the request is for a valid file, send to bootstrap if (!-e $request_filename) { rewrite ^(.+)$ /index.php? last; } # Pass PHP scripts on to PHP-FPM location ~* \.php$ { try_files $uri /index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }See if you notice anything weird, but this config seems to make everything work including Easy Fancybox.
RavanH!!!! It works!!!
I found your comments about WP and Nginx on another site (http://www.farinspace.com/wordpress-nginx-rewrite-rules/) and added this code to my Nginx Config:
# unless the request is for a valid file, send to bootstrap if (!-e $request_filename) { rewrite ^(.+)$ /index.php? last; }Also, my config in the last post looks a little different now since I got W3-TC to send my settings to my NGINX config. The main thing though is that that request_filename code you shared fixed Easy Fancybox. Thank you, RavanH for all your help and for sharing your knowledge on the web!
-Jon
Thank you for taking a look, RavanH!
Here are the CSS, PHP, and cache rules, which is based on a tutorial by WP Mayor (http://www.wpmayor.com/articles/ultimate-guide-setting-wordpress-vps-part-3/). W3-TC is disabled right now and there is no minification set in Cloudflare.
# Rewrite minified CSS and JS files location ~* \.(css|js) { if (!-f $request_filename) { rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last; # Use the following line instead for versions of W3TC pre-0.9.2.2 #rewrite ^/wp-content/w3tc/min/([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ $ } } # Set a variable to work around the lack of nested conditionals set $cache_uri $request_uri; # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $cache_uri 'no cache'; } if ($query_string != "") { set $cache_uri 'no cache'; } # Don't cache uris containing the following segments if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|$ set $cache_uri "no cache"; } # Don't use the cache for logged in users or recent commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") { set $cache_uri 'no cache'; } # Use cached or actual file if they exists, otherwise pass request to WordPress location / { try_files /wp-content/w3tc/pgcache/$cache_uri/_index.html $uri $uri/ /index.php; } # Cache static files for as long as possible location ~* \.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz$ try_files $uri =404; expires max; access_log off; } # Deny access to hidden files location ~* /\.ht { deny all; access_log off; log_not_found off; } # Pass PHP scripts on to PHP-FPM location ~* \.php$ { try_files $uri /index.php; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }Also if it’s relevant, here’s my rewrite rule so everything has a www.
rewrite ^(.*) http://www.jonathanmanness.com$1 permanent;Update…this error has nothing to do with varnish, but is likely related to switching hosts and different server set up. I’ll start a new thread since the topic is no longer relevant.
Checked your site and your plugin is working fine. It seems to be a Varnish issue, which was just installed on my site. The issue showed up in my other browsers AFTER clearing caches and cookies.
I’m asking around now to configure Varnish to play nice with Easy Fancybox. I’ll share a link if I find a solution.
Hmm…hopefully the developer can chime in. Good luck!
Also, if that’s the exact link you’re using, you might also need to replace the IP with a domain.
Try changing the google docs link to https instead of http (google changes it to https automatically…I also changed it to https on my site). Updated code below…
<a class="fancybox-iframe" href="https://docs.google.com/gview?url=http://LINKTOPDF.pdf&embedded=true">LINK</a>Are you replacing the url http://LINKTOPDF.pdf with the link?
Just about the same error in my dashboard:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in [redacted]/wp-content/plugins/jetpack/jetpack.php on line 1207
Warning: Invalid argument supplied for foreach() in [redacted]/wp-admin/includes/plugin.php on line 1439