Common cache and load balancing issues in Wordpress w3

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

The plugin (w3 shared cache) saves all files on disk inside the wp-content / cache folder. Now we use only one server, so everything works fine, but we should soon attach the second to the load balancer.

My question is: - Is it safe to attach the second server as is, without any changes to the plugin? Is there a risk that html inserts a cached css file that is present on only one server and not on another? - If this is unsafe, will the wp-content / cache shared folder solve the problem (symbolic link or so)?

Hello

+4
source share
1 answer

You can move the entire wp content folder to a shared directory on the file server. Ensure that directory permissions allow IIS to change permissions in the same way as the current wp content folder. Then create a virtual directory on your IIS website and point it to the shared path.

Thus, both web servers can share the same downloads, plugins, etc., and you don’t have to worry about trying to mirror both web servers. Make the following entry in 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 entering wp-config.php:

require_once(ABSPATH.’wp-settings.php’);
+2
source

Source: https://habr.com/ru/post/1626315/


All Articles