Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress w3 total cache and load balancing concerns

The website we are working on right now will be hosted on two load-balanced IIS servers. The database will be common, on a third server.

The plugin (w3 total cache) saves all the files on the disk, inside a wp-content/cache folder. Right now we are using only one server so everything works fine, but we have to attach the second one soon to the load balancer.

My question is: - Is it safe to attach the second server as is, without any modification in the plugin ? Do we encounter a risk of the html inserting a cached css file for example, that is present only on one server and not the other ? - If it is not safe, would a shared wp-content/cache folder solve the issue (symbolic link or so) ?

Regards

like image 434
TheTrueTDF Avatar asked Oct 31 '22 10:10

TheTrueTDF


1 Answers

You can move the entire wp-content folder to a shared directory on a file server. Ensure that the directory permissions allow IIS modify rights just like your current wp-content folder. Then create a virtual directory within your IIS website and point it to the shared path.

This way both web servers can share the same uploads, plugins etc. and you don't have to worry about trying to mirror both web servers. Make the following entry in the wp-config.php on each web server:

define('WP_CONTENT_DIR','//server/sharedpath'.'/wp-content');
define('WP_CONTENT_URL', 'https://url-to-virtual-directory/wp-content');

Do this before the entry in wp-config.php:

require_once(ABSPATH.’wp-settings.php’);
like image 81
dpjas Avatar answered Nov 04 '22 08:11

dpjas