如何在iisnode上运行Etherpad Lite

时间:2013-04-19 11:58:23

标签: iisnode etherpad

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

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

我的步骤(首次尝试)

  1. 将Etherpad Lite安装到c:\eplite,并确保在使用start.bat运行时它可以正常工作。
  2. 为IIS安装URL重写模块(iisnode需要)。
  3. 安装iisnode。
  4. 授予IIS_IUSRS对整个c:\eplite的完全控制权(一种过度杀伤,但要确保没有访问问题)。
  5. 配置指向c:\eplite
  6. 的IIS网站
  7. c:\eplite\node_modules\ep_etherpad-lite\Web.config移至c:\eplite
  8. 打开IE,我可以看到“类似”的东西,但它不起作用。在主页面上没有文字(只有字段和按钮),尝试打开打击垫会导致带有文本的工作区界面:

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

    我的步骤(在阅读讨论后第二次尝试here

    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网站+从Web.Config中的任何位置删除node_modules\ep_etherpad-lite路径。结果与原始步骤1-6相同。

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

    3. 版本信息

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

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

      在Windows 8上运行。

1 个答案:

答案 0 :(得分:0)

我在你提到的那个discussion中阅读了你和其他人的回复之后才开始工作,虽然它不是一个完美的解决方案,但有一些硬编码选项。

前六个步骤与您的相同。

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

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

<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&amp; 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替换它们来删除硬代码或目标路径,但这不起作用,并且会出现错误:npm.load()我把它放在asyns.waterfall部分之前。如果我将代理创建代码放在asyns.waterfall中的任何回调函数中,则会出现错误:连接EADDRNOTAVAIL 。我想知道是否还有其他更好的解决方案来集成IIS和以太网。谢谢!

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

相关问题