【问题标题】:Path to use in web.config when deploying Meteorjs部署 Meteorjs 时在 web.config 中使用的路径
【发布时间】:2014-11-18 01:48:20
【问题描述】:

尝试将 meteorjs 应用程序部署到 Azure,一切看起来都配置正确,除了我不确定指向什么:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation batch="false" />
  </system.web>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="myapp">
              <match url="/*" />
          <action type="Rewrite" url="server.js" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

我没有server.js。我正在从 nitrous.io 部署它,该应用程序按预期工作。我是否需要添加 server.js 文件,如果需要,内容应该是什么?否则,什么文件适合指向?

【问题讨论】:

    标签: azure deployment meteor config nitrousio


    【解决方案1】:

    构建的 Meteor 应用程序在你的应用程序的根文件夹中有 main.js,你应该将你的网络服务器指向这个文件。

    在重写规则中使用正则表达式:

    <match url="^(.*)$" ignoreCase="false" />
    

    所以你的配置文件将是:

    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <compilation batch="false" />
      </system.web>
      <system.webServer>
        <handlers>
          <add name="iisnode" path="main.js" verb="*" modules="iisnode" />
        </handlers>
        <rewrite>
          <rules>
            <rule name="myapp">
              <match url="^(.*)$" ignoreCase="false" />
              <action type="Rewrite" url="main.js" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    另外不要忘记为构建的 Meteor 设置 ENV 变量:MONGO_URLROOT_URL(带有协议的域,例如:http://my.site)、MAIL_URL 等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多