简体   繁体   English

如何在Azure上的现有node.js应用程序中安装Ghost?

[英]How to install Ghost inside an existing node.js application on Azure?

Can you install Ghost ( http://ghost.org ) so that it runs inside an existing node.js express application (like this: {my domain}/blog)? 您可以安装Ghost( http://ghost.org ),使其在现有的node.js Express应用程序(例如:{my domain} / blog)中运行吗?

I'm using Azure Websites to host the site. 我正在使用Azure网站托管网站。

Please note: I would prefer a generic solution that can run on any platform... however I thought I would mention that it's on Azure in case it provides a simple way to do this. 请注意:我希望可以在任何平台上运行的通用解决方案...但是我想我要提到的是,它在Azure上提供了一种简单的方法来实现。

Yes you can do that. 是的,你可以这么做。

You will need to: 您将需要:

1. Add a new blog application 1.添加一个新的博客应用程序

Basically go to portal -> CONFIGURE tab -> scroll all the way to the bottom and add something like this 基本上转到门户->配置选项卡->一直滚动到底部并添加类似的内容

添加应用

2. Configure Ghost to run on a sub folder 2.将Ghost配置为在子文件夹上运行

publish Ghost to whichever folder you mapped to your application in the step above. 将Ghost发布到您在上述步骤中映射到应用程序的任何文件夹。 You can use FTP, webdeploy or SCM ( https://<YouSiteName>.scm.azurewebsites.net/DebugConsole that's what I choose and my folder layout looks like this 您可以使用FTP, webdeploy或SCM( https://<YouSiteName>.scm.azurewebsites.net/DebugConsole ,这是我选择的,我的文件夹布局如下所示

安慰

igonre the deployments folder, it's not related to this igonre deployments文件夹,与此无关

in your config.js for Ghost, under the Production environment node make sure you have the url as 在Ghost的config.js中的“ Production环境”节点下,确保您的网址为

production: {
        url: 'http://<YourSiteName>.azurewebsites.net/blog',
        mail: {
          ......
         }
 }

3. Fix the main site's web.config 3.修复主站点的web.config

go to your main sites web.config and wrap the whole <system.webServer> element in a <location path="." inheritInChildApplications="false"> 转到您的主要站点web.config并将整个<system.webServer>元素包装在<location path="." inheritInChildApplications="false"> <location path="." inheritInChildApplications="false">

basically your web.config should have looked like this 基本上您的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>

and now it should look like this 现在看起来像这样

<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>

notice this is for the main site that is the Express.js in your case not the Ghost site 请注意,这是针对您所使用的Express.js而不是Ghost网站的主要网站

that should be all you need to do. 那应该就是你要做的。

Not sure if you can install it as an addition to your existing site, but Ghost exists as a deployable template in the Azure Web Sites gallery, under Blogs : 不知道是否可以将其安装为现有网站的补充,但是Ghost作为Azure站点画廊中Blogs下的可部署模板存在:

在此处输入图片说明

这不是您要找的完整答案,但是这些有关如何在Azure网站上手动安装Ghost的说明可能会帮助您正确方向: http : //www.hanselman.com/blog/HowToInstallTheNodejsGhostBloggingSoftwareOnAzureWebsites.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM