How To

How to install Ghost on Zpanel with multiple instances?

Written by Durgesh Gupta

Ghost is an incredibly stand alone modern designed just for blogging platform, while using it gives you pleasure, installing it for beginner is a little hectic.

I am assuming if you are reading this relevant post then you must have a VPS/Dedicated ready server or if you are testing on local virtual machine then your machine must running with latest Zpanel version up to this post is written.

The first couple of steps are simply will redirect you to articles where you can get better guide to install Node.js and Ghost, you can simply follow below two steps to get job done, or if you may also want to explore How to Install latest Zpanel?.

Step 1: Install Node.js – follow url to do that : http://support.ghost.org/deploying-ghost/

Step 2: Install GHost – As per instruction: http://support.ghost.org/installing-ghost-linux/

Now in third step you need to be little conscious as you already had apache running on port 80 now you have installed Ghost with Node.js which by default runs on port 2368 (which you can change later) but your server dilemma is that a single port for example port 50 for httpd service can not be occupied by two server app i.e. Apache and Ghost+Node.js both needs to be run different port in order to run together which is the real problem.

Here you got a situation, you already have a corporate static php based website and you just need to dynamic the yourdomain.com/blog section with the help of lightweighted amazingly fast Ghost powered by Node.js.

Now the question is how to put both different technology on port 80 so that Ghost can be accessible on port rather that on yourdomain.com:2368.

Its pretty simple you have to utilize the function of your existing apache server installation, Apache has a function called ProxyPass and ProxyPass Reverse follow the step 3 to get this job done.

Step 3: Login to Winscp and Go to /etc/zpanel/configs/apache/httpd-vhosts.conf and insert following line inside the

Change production part of Ghost under config.js to 1000 

Ghost install domain tag

<location /blog>

ProxyPass http://localhost:1000/blog

ProxyPassReverse http://localhost:1000/blog

</location>

In above <location tag is the location of your Ghost blog.

now save the file and restart apache service by executing service httpd restart

to start Ghost issue following command

npm start –production (you must at your Ghost file location to do that)

In case of  Error: ENOENT, open ‘ /path/to/file

first check for path, you must be at right GHost path if then too did not work.

just execute following command npm cache clean

How to setup multiple instances of Ghost?

It is even better and efficient way to do that better than Step 3, the drawback in Step 3 if you have modified the /etc/zpanel/configs/apache/httpd-vhosts.conf file manually then in future if you are updating a new domain or subdomain the Zpanel will default override the content of httpd-vhosts.confg file from it’s relevant  table named x_vhost, field vh_custom_tx with appropriate domain set value.

To make sure this does not happen you need to insert the manual lines of location tag code into Zpanel Core database to do that follow the below instruction.

Step 1. In case of Multiple Instance all you need to do is change production part of Ghost port under config.js

Step 2. Update the relevant port must be different and not occupied by other Ghost config.js file.

Step 3: Also in Zpanel core database under table named x_vhost locate your domain name, browse the field vh_custom_tx and put # custom VH settings (if any exist) and enter manually the specific custom value in relevant domain i.e.

<location /blog>

ProxyPass http://localhost:1000/blog

ProxyPassReverse http://localhost:1000/blog

</location>

After this if in future if overriding happens the value remain unchanged for the specific domain in file httpd-vhost.confg.

Now as usual restart apache service by executing service httpd restart

to start Ghost issue following command

npm start –production

In each Ghost instances under config.js port must be different and same should reflech under httpd-vhost.confg file of apache for specific domain name.

This process is self tested and if you are facing any issue or got a better way to accomplished the task then must share in comment box.

 

 

About the author

Durgesh Gupta

Leave a Comment