3

我在我的云服务器上托管了几个网站。我想将 Ghost 用于其中一个网站的“博客”子域。

我已经成功安装了 Ghost,并且开发环境在 localhost 中运行良好。但是,现在在 2365 端口运行的生产环境在 www.blog.foobar.com:2365 上打开得很好

我需要它在 www.blog.foobar.com 上打开

我尝试在 config.js 中将端口设置为 80,但出现错误:listen EACCES 即使 IIS 中的 ARR 也不起作用。尝试了谷歌搜索结果中建议的几乎所有步骤。反向代理只是将子域重定向到 index.js

  1. Node.js v0.10.21 x64
  2. 幽灵 0.3.3
  3. iisnode x64
  4. 视窗服务器 2012
  5. IIS 8
  6. 火狐

我在 config.js 中将端口设置为 2365,就好像我将其设置为 80 一样,它根本不会启动。我的 IIS 站点绑定在端口 80。

4

2 回答 2

6

终于在鬼论坛的帮助下弄明白了。假设您已经安装了 iisnode 并且在您的域注册商处为您的子域提供了 A 记录,请继续:

  1. 在配置文件中更改web.config
  2. 如下更改 config.js 生产部分

    host: '127.0.0.1', port: process.env.PORT

  3. 将其保留bindings在您的子域 IIS 站点设置中,即80

  4. productionindex.js文件中的 ENV 更改为development
  5. 享受写博客:)
于 2013-10-25T05:06:20.610 回答
1

这是我在 Windows 7 上的操作方式。

部分说明在这里。其他人可以在这里找到

安装软件

1)安装node-v0.10.26-x64

2) Installed iisnode-full-iis7-v0.2.2-x64

3) Ran setupsamples.bat inside C:\Program Files\iisnode

Setup Directory

4) Removed everything inside C:\Program Files\iisnode\www

5) Extracted ghost-0.7.1 inside C:\Program Files\iisnode\www

Install Node Modules

6) Ran Node.js command prompt as administrator

7) Typed c:

8) Typed cd C:\Program Files\iisnode\www

9) "npm install --production" | command to install npm

10) Sqlite3 didn't install so had to run "npm install https://github.com/mapbox/node-sqlite3/tarball/master" to install it

Configure

11) Had to install url rewrite

12) Altered C:\Program Files\iisnode\www\config.js under development url: 'http://localhost/blog', port: process.env.PORT

13) still on the node.js command prompt inside C:\Program Files\iisnode\www typed "node.exe index.js" to run it

14) Removed node from iis and added application blog and pointed it to my dir C:\Program Files\iisnode\www

15) Added the web.config inside C:\Program Files\iisnode\www

<configuration>  
<system.webServer>
<modules>
    <remove name="WebDAVModule" />
</modules>
<handlers>
        <remove name="WebDAV" />
  <add name="iisnode" path="index.js" verb="*" modules="iisnode" />
  <add name="WebDAV" path="*" verb="" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />
</handlers>
<defaultDocument enabled="true">
  <files>
    <add value="index.js" />
  </files>
</defaultDocument>
<rewrite>
  <rules>
    <rule name="Ghost">
      <match url="/*" />
      <conditions>
        <add input="{PATH_INFO}" pattern=".+\.js\/debug\/?" negate="true" />
      </conditions>          
      <action type="Rewrite" url="index.js" />
    </rule>
  </rules>
</rewrite>
<!--
  See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for information regarding iisnode specific configuration options.
-->
<iisnode node_env="%node_env%" loggingEnabled="false" debuggingEnabled="false" devErrorsEnabled="false" />
</system.webServer>
</configuration>   
于 2015-11-25T16:25:43.970 回答