简体   繁体   English

Wordpress w3总缓存和负载平衡问题

[英]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. 我们现在正在处理的网站将托管在两个负载均衡的IIS服务器上。 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. 插件(w3总缓存)将所有文件保存在wp-content / cache文件夹中。 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 ? 例如,我们是否遇到html插入缓存的css文件的风险,该文件仅存在于一台服务器而不存在于另一台服务器上? - If it is not safe, would a shared wp-content/cache folder solve the issue (symbolic link or so) ? - 如果不安全,共享的wp-content / cache文件夹会解决问题(符号链接等)吗?

Regards 问候

You can move the entire wp-content folder to a shared directory on a file server. 您可以将整个wp-content文件夹移动到文件服务器上的共享目录中。 Ensure that the directory permissions allow IIS modify rights just like your current wp-content folder. 确保目录权限允许IIS修改权限,就像当前的wp-content文件夹一样。 Then create a virtual directory within your IIS website and point it to the shared path. 然后在IIS网站中创建一个虚拟目录,并将其指向共享路径。

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. 这样,两个Web服务器都可以共享相同的上载,插件等,您不必担心尝试镜像这两个Web服务器。 Make the following entry in the wp-config.php on each web server: 在每个Web服务器上的wp-config.php中进行以下输入:

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: 在wp-config.php中输入之前执行此操作:

require_once(ABSPATH.’wp-settings.php’);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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