Wordpress caching - using W3 Total cache with CloudFront vs using CloudFront directly - wordpress

If you have already deployed your wordpress instance to AWS, which scenario for CDN makes more sense?
Using CloudFront directly on top of a LoadBalancer.
Using CloudFront with W3 Total Cache plugin?

If you expect high volume of traffic to your WordPress website the better option will be the first one:
Using CloudFront directly on top of a LoadBalancer.
If you are in the beginning of your project the better option will be the second one:
Using CloudFront with W3 Total Cache plugin?
Also please note that you are comparing server architecture and configuration versus plugin. Which are two completely different things. These two completely different things can also work together with no issues (if configured properly of course) and you will have the next setup:
Using CloudFront directly on top of a LoadBalancer with W3 Total Cache plugin.
Another hint: if you are in the beginning of your project or not familiar how to configure complex plugin with many options such as W3TC, I would recommend you cache plugin with less options and more simple. Recently, I have started using WPCacheOn recently on all of the websites, I am using and I am very happy with it. Simply install and activate the WPCacheOn and no further configurations or settings are needed for faster website.
I hope this information helps you in choosing your setup and cache plugin for your project.

Related

Cloudflare with WPRocket

So... I just created a new CDN through CF. I'd like to know how long does it take the DNS to propagate worldwide? I tried registering the CDN that I created in CF into WPRocket but it's breaking my site. I don't know if is because of the timeframe that I need to wait or that I'm doing something wrong within the crypto config in CF.
Generally cloudflare takes 24 hours to propogate dns records through wordwide. After that website will serve request through cloudflare. And issue of your site brokedown is may be minification of jQuery or css in wp-rocket or defer parsing of script. Also you can use http://whatsmydns.net for checking DNS entries.
You don't need to configure the CDN section in WP Rocket for services like cloudflare or sucuri.
There's an addon (activated inside WP Rocket) for cloudflare where you just need to fill in your API key and that's it.
I believe you don't even need to set the addon and the API key for cloudflare to work with your website and WP Rocket, the addon is "just" for controling cloudflare directly from wordpress dashboard (purge cloudflare cache, enable development mode, etc)

WPML with Subdomains behaves very strange in combination with multiple environments

I'm currently working on a clients website where we want to split up the live environment into three different ones.
We currently want the following envs:
Production (Live website)
Preview (Unpublished live website for content management)
Staging (Development state for feature and development previews)
We have them setup via the following subdomains:
Live:
de.xyz.com
en.xyz.com
ch.xyz.com
Preview:
de.preview.xyz.com
en.preview.xyz.com
ch.preview.xyz.com
Staging:
de.staging.xyz.com
en.preview.xyz.com
ch.preview.xyz.com
NOTE: We're also using the WP cache with advanced-cache.php in combination with WP Engine Advanced Cache. Maybe thats a conflict?
Anyway, when I now login to the different backends and try to map the subdomains and save somehow the environments overwrite each others settings again, even though they are on separated webservers and use separated databases.
I'm really confused because when I for example set en.preview.xyz.com on the preview domain, somehow the same en.preview.xyz.com value is set on the staging environment.
Are there any known conflicts with WPML Subdomains and multiple Websites on the same parent domain or a caching plugin?
Thanks already a lot. My client already is kind of annoyed because the content managers are waiting.
Greetings!
I found the answer for my problem.
Basically the WP Supercache Plugin was setup wrong to work with different environments. I had to load the WP_CACHE_KEY_SALT from the .env-files in the object-cache.php

How to proxy a rails app in heroku with a WP blog under same domain

I have this:
A rails app on Heroku that servers mydomain.com
A WP site on another hosting (that I can move to AWS .. or even heroku)
I need that mydomain.com/blog serves the WP installation, I DONT want it to be a subdomain for SEO.
My first idea was setup apache / nginx as reverse proxy on a instance on AWS. However I worried that this setup is not optimal as backends are in different services.
It's possible to setup heroku dyno as a proxy? I understand there is no way to modify the system files on heroku, like create a custom nginx setup to do the proxy. I was wondering if there is some application that works as a proxy and can be installed in heroku, next setup the blog in heroku also.
Or it's a good idea to setup an AWS instance as proxy in the same region that the heroku is (us-west1), and setup the blog also there.
I'm interested in the pros and cons of each solution and what would be the best way to go.
I had tackled the same exact problem with Rails and WP for quite some time.
My configuration and result:
Rails app is hosted on heroku (www.sexycrets.com)
WP Blog is hosted on another server (blog.sexycrets.com)
When the browser requests www.sexycrets.com/blog he receives the same html page that he would have received if browsing blog.sexycrets.com and the url on the browser remains the same
How I achieved it
One solution that does works well for SEO is to use a gem as reverse proxy (I use drewwed/rack-reverse-proxy from Github). You can configure it to intercept the route "/blog" (and "/blog/") so that every time Rails is asked for /blog it loads your WP site with a backend call and returns it to the user. This is a completely transparent operation from the user browser perspective, aside from the delay introduced. The user browser has no way to know that the blog page returned in the response was loaded from another server, the url on the browser remains "www.sexycrets.com/blog".
Pros: SEO requirements are satisfied
Cons: Performance since the reverse proxy is not very performant in terms of delay introduced
Alternative
For sake of completeness the other option I tried was to use an iFrame in a static page hosted on heroku that loads the WP. The problem is that in order for it to work avoiding a circular reference all the links in the WP blog have to point to blog.sexycret.com (not www.sexycrets.com/blog) which partly defeats the SEO purpose.
Pros: Performance is very good since it is not even using Rails: the user browser loads the static /public/blog/index.html page that contains just the iFrame that points to the WP blog
Cons: the links in the blog are not pointing to the main domain but to the 3rd level domain defeating
Hope this helps!

Host complete WordPress website in Amazon CloudFront or any other CDN

What I would like to do
According to a Amazon Senior Architect to whom I spoke recently, it is possible to cache dynamic website content in Amazon CloudFront.
The way I understand how this could work, is that in addition to doing a page cache of each page which has been accessed, cache the page in CloudFront too.
What I have tried
I have experimented a lot with W3 Total Cache and its settings but did not find a solution to this problem. I also have tried to set up CloudFront directly in the AWS control panel but did not find a way to cache the static result (html?) of WordPress's php calls.
Question
How would you tackle the issue?
How can I cache a static version of WordPress's dynamic pages in CloudFront or any other CDN?
Here is a concept plugin which aims to do this:
https://github.com/PeterBooker/wp-cloudfront-helper
most CDNs advertise that they can cache dynamic web sites. Unless they have very specific information about the pages they need to serve, they can't. There are situations where the "penalty" of a CDN for a dynamic page isn't that bad, but having an additional hop in-between the web server and the end user can only be faster in some very specific situations. The main reason is the absense of a Last-Modified header for the generated pages.
From my experience working with (at) CDN providers, the most performant way to include a CDN is to use a different hostname for the static assets and point that hostname to the CDN with your web server as the origin server.
Jan

Running multiple Wordpress sites on a single domain/web server

I have a rather general but very important question. I have built a main website and an eShop for a client. The main website is in Wordpress and I have to find a platform for the eShop, but let's say it's also a Wordpress theme.
Can I install 2 wordpress sites in my hosting server? So for example, the first one will be www.company.com/website and the other being www.company.com/shop.
Yes you can: Installing Multiple Blogs « WordPress Codex.
While all the previous answers are technically correcct - they will have you doing twice the work that is actually needed for your desired outcome (as in two installs, two upgrades, two sets of security checks, two databases, two admin panels... you get the idea - two times the work, all unnecessary).
Since Wordpress 3.0, the WordpressMU features have been integrated into the core. This allows you to run multiple Wordprsss 'sites' from a single install.
Sites can be served from their different domain, sub-domains, or in your case different sub-directories within the same domain and server.
Full information on how to achieve this is available from Wordpress Codex:
Create A Network
Just install one wordpress app in your root directory and create the other directory and install it there, there should be no problem.
Keep in mind that if you are routing around a port 80 blockade (aka using a different port to host your site) then Multi-site WILL NOT WORK. In such an instance multiple WP installations seem to be the ticket.
You can choose a directory relative to your root domain when installing wordpress on your site.

Resources