1

如何使用 iisnode 在 IIS 上运行 Etherpad Lite?

(经过更多调查后于 2013-04-23 更新)

我的步骤(第一次尝试)

  1. 安装 Etherpad Litec:\eplite并确保它在与 start.bat 一起运行时工作。
  2. 为 IIS 安装 URL 重写模块(iisnode 需要)。
  3. 安装 iisnode。
  4. 授予 IIS_IUSRS 对整体c:\eplite的完全控制权(有点矫枉过正,但要确保没有访问问题)。
  5. 配置指向c:\eplite.
  6. 移至。c:\eplite\node_modules\ep_etherpad-lite\Web.config_c:\eplite

打开 IE,我可以看到“类似”etherpad 的东西,但它不起作用。在主页上没有文本(只有字段和按钮),尝试打开 pad 会导致 pad 界面无法正常工作:

An error occured while loading the pad
Invalid argument. in http://localhost/static/js/l10n.js (line 1)

我的步骤(第二次尝试,在这里阅读讨论后)

7.编辑 settings.json:删除port.

8.创建 c:\eplite\start_iisnode.bat:

cd c:\eplite
node "c:\Program Files\iisnode\interceptor.js" "c:\eplite\node_modules\ep_etherpad-lite\node\server.js"

9.将以下行添加到 Web.Config:

<iisnode nodeProcessCommandLine="c:\eplite\start_iisnode.bat" />

打开IE,这次可以看到正确的起始页了。打开焊盘会导致带文本的焊盘界面失效:

An error occured while loading the pad
The module at "ep_etherpad-lite/static/js/rjquery" does not exist. in http://localhost/static/js/require-kernel.js (line 1)

根据进程监视器,它尝试在以下路径中找到此模块:

C:\eplite\node_modules\ep_etherpad-lite\static\pipe\fb92fd16-78e4-4f00-bac4-6a4935ebd0d4\static\plugins\ep_etherpad-lite\static\js\rjquery.js

我还尝试过什么

  1. 步骤 1-4 + 配置指向 c:\eplite\node_modules\ep_etherpad-lite(Web.config 位置)的 IIS 网站 +node_modules\ep_etherpad-lite从 Web.Config 中的任何位置删除路径。结果与原始步骤 1-6 相同。

  2. 步骤 1-4,7-9 + 配置指向 c:\eplite\node_modules\ep_etherpad-lite(Web.config 位置)的 IIS 网站 +node_modules\ep_etherpad-lite从 Web.Config 中的任何位置删除路径。结果与原始步骤 1-9 相同。

版本信息

来自“master”代码分支(最新版本是 1.2.10)的 Etherpad Lite,使用 installOnWindows.bat 构建。

节点版本 0.8.4 x64,iisnode 版本 0.2.4 x64。

在 Windows 8 上运行。

4

1 回答 1

0

在您提到的讨论中阅读您和其他人的回复后,我使它工作,虽然它不是一个完美的解决方案,并且有一些硬编码选项。

前六个步骤与您的相同。

对于第 7 步,请勿删除 settings.json 中的端口,因为这将在后续步骤中使用。

第 8 步和第 9 步不是必需的,但您可以将 web.config 的内容更改为此,如@ghost 的帖子所示:

<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="iisnode" />
          <action type="Rewrite" url="node_modules/ep_etherpad-lite/node/iisnode" />
        </rule>
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </rule>
        <rule name="StaticContent">
          <action type="Rewrite" url="public{{REQUEST_URI}}" />
        </rule>
        <rule name="DynamicContent">
          <conditions>
            <add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="True" />
          </conditions>
          <action type="Rewrite" url="server.js" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

之后,从 etherpad 的根路径(例如 c:\eplite)创建一个符号链接到实际的 server.js 文件(C:\eplite\node_modules\ep_etherpad-lite\node\server.js)。这可以通过使用MKLINK来完成。在此示例中,您可以在 cmd 中键入:

mklink c:\eplite\server.js C:\eplite\node_modules\ep_etherpad-lite\node\server.js

“这解决了 Node 遇到的一些奇怪的路径/模块未找到问题。” 然后我们需要将 http-proxy 模块添加到 etherpad-lite。在 cmd 中设置当前文档为 C:\eplite\node_modules\ep_etherpad-lite 并运行npm update & npm install http-proxy最后将这些代码放在 server.js 的开头:

var http = require('http'),
    httpProxy = require('http-proxy');

httpProxy.createProxyServer({target:'http://localhost:9001'}).listen(process.env.PORT); 

请注意,目标路径中的端口应与 setting.json 中的端口相同,否则您无法从 IIS 中绑定的路径访问 etherpad 站点。

我试图通过将它们替换为 settings.port 来删除硬代码或目标路径,但这不起作用并且会出现错误:如果我将它放在 asyncs.waterfall 部分之前,则需要 npm.load() 。如果我将代理创建代码放在 asyncs.waterfall 内的任何回调函数中,将会出现错误:连接 EADDRNOTAVAIL。我想知道是否还有其他更好的集成 IIS 和 etherpad 的解决方案。谢谢!。

我的环境是开发分支的 Win7 + Node.Js 0.10 + IIS7 + iisnode v0.2.16 + etherpad Lite(最新版本是 1.4.10)

于 2014-10-15T21:57:16.223 回答