简体   繁体   English

具有共享wp内容的IIS上的Wordpress

[英]Wordpress on IIS with shared wp-content

I've been trying to install Wordpress on IIS and everything went smoothly with a standard installation and an handler mapping for php-cgi. 我一直在尝试在IIS上安装Wordpress,并且通过标准安装和php-cgi的处理程序映射,一切都能顺利进行。

Since I have a public server (A) and a private shared server (B), I need to have a WP installation on server A with a shared database and shared wp-content on server B. 由于我有一个公共服务器(A)和一个私有共享服务器(B),因此我需要在服务器A上进行WP安装,并使用共享数据库和服务器B上共享的wp-content。

The main issue is configuring a Virtual Directory on IIS for wp-content on server B with the required permissions. 主要问题是使用必需的权限在IIS上为服务器B上的wp-content配置虚拟目录。 The Wordpress on server A is able to access the media resources (images and other files). 服务器A上的Wordpress能够访问媒体资源(图像和其他文件)。 Through wp-admin, I can also access and upload new resources to the shared wp-content. 通过wp-admin,我还可以访问新资源并将其上传到共享的wp-content。

The problem starts as soon as I try to see the installed plugins or install new ones, since WP can't access the plugins folder, and, as a consequence, the website can't be viewed as well. 当我尝试查看已安装的插件或安装新的插件时,问题就开始了,因为WP无法访问plugins文件夹,因此也无法查看该网站。

I've already tried several things in order to solve the referred problem. 我已经尝试了几种方法来解决所提到的问题。

The steps I tried, not necessarily in this order, were: 我尝试的步骤(不一定按此顺序)是:

  • Created an user on both machines with the required permissions on wp-content; 在两台计算机上创建一个对wp-content具有所需权限的用户;

  • Gave full access permissions to that user (also Everyone) on wp-content; 对wp-content授予该用户(也包括所有人)的完全访问权限;

  • Created a Virtual Directory on IIS and Connecting As the created user; 在IIS上创建虚拟目录并以创建的用户身份进行连接;
  • Running the Default Web Site APP Pool with that user; 与该用户一起运行默认网站APP池;

At the step I'm at, the wordpress does not load the installed plugins and asks for FTP credentials while trying to install new ones. 在我执行的步骤中,wordpress不会加载已安装的插件,并在尝试安装新插件时要求提供FTP凭据。

It seems to me that the problem may be with additional permissions that I don't know about. 在我看来,问题可能出在我不知道的其他权限上。

If anyone has successfully accessed a shared wp-content with IIS, please help me before I go mad. 如果有人成功访问了与IIS共享的wp内容,请在发疯之前帮助我。

Thanks in advance 提前致谢

Assuming: 假设:

+-----------+      +----------+
|  Server A | <--  | Server B |
+-----------+      +----------+

First, lets look at the App Pool for Server A -> Site A and Server B -> Site B. I would advise using Impersonation versus a service account. 首先,让我们看一下服务器A->站点A和服务器B->站点B的应用程序池。我建议使用模拟服务而不是服务帐户。 This will allow you to leverage AD or Local Users. 这将允许您利用AD或本地用户。

Second test with the UNC path in Explorer from Server B to Server A (\\server-a\\wp-content). 使用从服务器B到服务器A的资源管理器中的UNC路径进行第二次测试(\\ server-a \\ wp-content)。 If you have not setup a share, you may want to do this. 如果尚未设置共享,则可能需要执行此操作。 You're going to encounter speed issues etc, but I don't think it will be bad. 您将遇到速度问题等,但我认为这不会很糟糕。 Map a drive, for example Z:\\ , to this path. 将驱动器(例如Z:\\映射到此路径。

If you stick with a service account, make sure that IIS_IUSR and Users groups have Read & Execute permissions and make sure the Computer account of Server B is a member of those groups (create a computer account for Server B if needed). 如果您坚持使用服务帐户,请确保IIS_IUSR和“ Users组具有“读取和执行”权限,并确保服务器B的计算机帐户是这些组的成员(如果需要,请为服务器B创建一个计算机帐户)。

If we get this far, I think we need a symbolic link. 如果到此为止,我认为我们需要一个符号链接。 A virtual directory would be great but does not work for file system calls from PHP. 虚拟目录非常有用,但不适用于PHP中的文件系统调用。 For example if a page attempts to make a include not using a URL path. 例如,如果页面尝试不使用URL路径进行包含。

This should help: http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/ 这应该会有所帮助: http : //www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

On Server B run something like: 在服务器B上运行以下命令:

mklink /J C:\inetpub\wwwroot\wp-content Z:\

Adjust for the proper paths on your server. 调整服务器上的正确路径。

Hope this helps. 希望这可以帮助。

Assuming the situation described on the initial question 假设第一个问题描述的情况

+---------------------+      +-----------------------------+
|  Server A (IIS / WP)| -->  | Server B (wp-content/mySQL) |
+---------------------+      +-----------------------------+

Solution: 解:

  • Create user X on servers A and B with same credentials; 使用相同的凭据在服务器A和B上创建用户X;
  • on server B, share wp-content with user X (full permissions); 在服务器B上,与用户X共享wp-content(完全权限);
  • on server B, set FULL CONTROL security permissions to user X; 在服务器B上,为用户X设置“完全控制”安全权限;
  • on server A, add user X to group IIS_IUSRS; 在服务器A上,将用户X添加到组IIS_IUSRS;
  • on server A, create a symbolic link as referred by @Twisty (Ex.: mklink /dc:\\inetpub\\wwwroot\\wp-content \\\\); 在服务器A上,创建由@Twisty引用的符号链接(例如:mklink / dc:\\ inetpub \\ wwwroot \\ wp-content \\\\);
  • on server A, set FULL CONTROL security permissions to user X on the symbolic link (c:\\inetpub\\wwwroot\\wp-content); 在服务器A上,在符号链接(c:\\ inetpub \\ wwwroot \\ wp-content)上为用户X设置“完全控制”安全权限;
  • on server A, on IIS, run the Default Web Site as user X (Default Web Site -> Basic Settings -> Connect as... -> Specific user); 在服务器A上的IIS上,以用户X的身份运行默认网站(默认网站->基本设置->连接为...->特定用户);
  • on server A, iisreset just to be safe. 在服务器A上,iisreset只是为了安全起见。

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

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