Pre Condition
Ghost’s currently recommended Node version is Node v10 LTS. Node 8.x (Node v8 Carbon LTS) is also supported.
IISNode and the IIS URL Rewrite module must be installed.
First, install the Ghost CLI:
npm install -g ghost-cli@latestCreate a new empty folder
mkdir ghost
Change directory into the folder
cd ghost
Install a local environment with the Ghost CLI
Install local environment via ghost cl
ghost install localOpen your browser and go to
http://127.0.0.1:2368
Production
Set production mode via an environment variable
set NODE_ENV=productionInstall Ghost and create a default configuration
ghost install --db sqlite3 --no-prompt --no-stack --no-setup --dir .
cd .
ghost config --ip 127.0.0.1 --port 2368 --no-prompt --db sqlite3 --url https://blog.mydomain.deRun the database migrations to validate the database tables
ghost setup migrate
Adjust the config file (config.production.json)
Remove the port, because IISNode injects it via an environment variable.
{
"url": "https://blog.mydomain.de",
"server": {
"host": "127.0.0.1"
},
...
}Test the actual config
set server__port=2368Then start a new Node process from the terminal.
node current/index.jsIf the server starts and you can open it in the browser at http://127.0.0.1:2368, stop the process with Ctrl+C.
index.js and web.config for IISNode
Create an index.js file in the root folder of ghost that contains:
process.env.server__port = process.env.PORT;
require('./current/index.js')This way, IIS can inject the port dynamically.
You also need a web.config file for IIS:
<configuration>
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<clear />
<remove name="WebDAV" />
<add name="iisnode" path="index.js" verb="*" type="" modules="iisnode" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
</handlers>
<iisnode node_env="production" enableXFF="true" nodeProcessCountPerApplication="1" />
<rewrite>
<rules>
<rule name="ghost">
<match url="/*" />
<action type="Rewrite" url="index.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>IIS configuration
Finally, create a new site in your application pool with a binding to your domain, e.g.
https://blog.mydomain.de
Then set the physical path to the root folder of ghost.
Ghost should now run on your domain.
Adding new content
Use the Ghost admin tools to add new content to your blog:
The End
If you found any problem following the tutorial, please leave your comment below.
If this post was helpful, please click the ❤️ and ? button below a few times to show your support! ⬇⬇