Alex
Alex

Reputation: 83

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.

Upvotes: 1

Views: 1132

Answers (3)

ahmelsayed
ahmelsayed

Reputation: 7402

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

add application

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

console

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

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.

Upvotes: 2

Zain Rizvi
Zain Rizvi

Reputation: 24656

This is not the complete answer you were looking for, but these instructions on how to manually install Ghost on Azure Websites might help guide you in the right direction: http://www.hanselman.com/blog/HowToInstallTheNodejsGhostBloggingSoftwareOnAzureWebsites.aspx

Upvotes: 0

David Makogon
David Makogon

Reputation: 71120

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:

enter image description here

Upvotes: 0

Related Questions