简体   繁体   中英

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

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’);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM