简体   繁体   中英

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

I'm using Azure Websites to host the site.

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.

Yes you can do that.

You will need to:

1. Add a new blog application

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

publish Ghost to whichever folder you mapped to your application in the step above. 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

安慰

igonre the deployments folder, it's not related to this

in your config.js for Ghost, under the Production environment node make sure you have the url as

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

3. Fix the main site's web.config

go to your main sites web.config and wrap the whole <system.webServer> element in a <location path="." inheritInChildApplications="false"> <location path="." inheritInChildApplications="false">

basically your web.config should have looked like this

<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

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 :

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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