如何在Azure上现有的node.js应用程序中安装Ghost?
你可以安装Ghost( http://ghost.org ),以便它运行在一个现有的node.js快递应用程序(如:{我的域名} /博客)?
我正在使用Azure网站托pipe该网站。
请注意:我更喜欢可以在任何平台上运行的通用解决scheme…但是我想我会提到它在Azure上,以便它提供一种简单的方法来执行此操作。
是的,你可以这么做。
您将需要:
1.添加一个新的博客应用程序
基本上去门户 – >configuration选项卡 – >滚动一路到底部,并添加这样的东西
2.configurationGhost在子文件夹上运行
将Ghost发布到您在上述步骤中映射到您的应用程序的文件夹。 您可以使用FTP, webdeploy或SCM( https://<YouSiteName>.scm.azurewebsites.net/DebugConsole
这是我select和我的文件夹布局看起来像这样
igonre deployments
文件夹,这是不相关的
在Ghost的config.js
中,在Production
环境节点下,确保你的url为
production: { url: 'http://<YourSiteName>.azurewebsites.net/blog', mail: { ...... } }
3.修复主站点的web.config
转到您的主要网站web.config,并将整个<system.webServer>
元素包装在<location path="." inheritInChildApplications="false">
<location path="." inheritInChildApplications="false">
基本上你的web.config
应该看起来像这样
<configuration> <system.webServer> <handlers> <add name="iisnode" path="server.js" verb="*" modules="iisnode"/> </handlers> <rewrite> <rules> <!-- Some rewrite rules --> </rules> </rewrite> .... </system.webServer> </configuration>
现在应该看起来像这样
<configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <add name="iisnode" path="server.js" verb="*" modules="iisnode"/> </handlers> <rewrite> <rules> <!-- Some rewrite rules --> </rules> </rewrite> .... </system.webServer> </location> </configuration>
请注意,这是针对您的情况下的Express.js而不是Ghost网站的主要网站
这应该是你需要做的。
不知道您是否可以将其作为现有网站的补充进行安装,但Ghost在Azure网站库中位于“ 博客”下的可部署模板中存在:
这不是您正在查找的完整答案,但是有关如何在Azure网站上手动安装Ghost的说明可能有助于您指引正确的方向: http : //www.hanselman.com/blog/HowToInstallTheNodejsGhostBloggingSoftwareOnAzureWebsites.aspx