> ## Content Index
> Fetch the complete content index at: https://ghost.skillshub.info/llms.txt
> Use this file to discover other available public pages before exploring further.

# Setting Up Ghost As An App on ServerPilot
- URL: https://ghost.skillshub.info/setting-up-ghost-as-an-app-on-serverpilot/
- Published: 2017-01-19T02:59:00.000Z
- Updated: 2017-01-18T05:26:19.000Z
- Author: Francis
- Tags: Tutorials, #Import 2026-11-23 14:49

## What is Serverpilot?

It is a service that helps maintain your server automatically. Read more in this article that I wrote about connecting your server with ServerPilot - [Managing a DigitalOcean Server With ServerPilot](https://ghost.skillshub.info/managing-a-digitalocean-server-with-serverpilot/)

## What is this used for?

[Serverpilot.](https://www.serverpilot.io/?refcode=ffd835b5a302&ref=ghost.skillshub.info) calls all web sites that you setup on your server using ServerPilot, an 'app'.  
Traditionally [Serverpilot](https://www.serverpilot.io/?refcode=ffd835b5a302&ref=ghost.skillshub.info) only supports php based apps but you can actually setup apps based on other programming languages as described here:  
[https://serverpilot.io/community/articles/how-to-run-apps-in-any-language.html](https://serverpilot.io/community/articles/how-to-run-apps-in-any-language.html?ref=ghost.skillshub.info)

#### WHAT TO UNDERSTAND

The most important take-away when setting up non-php apps on ServerPilot is:

 If the instructions you're following are telling you to install or in any way configure Nginx or Apache, do not follow them! Instead, look for instructions that show you only how to install the app itself. It is safe to install packages that aren't web servers, such as nodejs, npm, ruby, python, pip, java, or perl. 

## Ok, let's do it! (in 5 quick steps)

① Have a quick glance at the tutorial "how-to-run-apps-in-any-language" mentioned above

② Download and Install the Node.js Source Code on your server, using these commands   
  
(run as root or use sudo if you prefer to play it safe :)

```
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
apt-get install -y nodejs

```

**REMEMBER:** Ghost prefers node.js version 4.x, (Node v4 argon LTS.) Read more here:  
[http://support.ghost.org/supported-node-versions/](http://support.ghost.org/supported-node-versions/?ref=ghost.skillshub.info)

③ Copy or move over your ghost files using e.g. SFTP   
  
(to install Ghost from scratch , see the bottom of this page)

```
all files need to go your apps 'public' directory on your server
e.g. /srv/users/serverpilot/apps/APPNAME/public

```

 Replace APPNAME with the name of your app. You should make sure all files have serverpilots permissions. That can be done by running this command inside the public directory: 

\`chown -R serverpilot:serverpilot \*\` 

④ Proxy Requests to Your Ghost App's Port   
  
**a)** SSH or SFTP in to your server as the user the app belongs to (e.g., serverpilot)   
  
**b)** create the file apps/APPNAME/public/.htaccess with the following contents (replace 2368 with the port your Ghost app is running on):

```
RewriteRule index.html http://localhost:2368/ [P]
RewriteRule (.*) http://localhost:2368/$1 [P]

```

An easy way to do this is to run this command as the serverpilot user:  
`nano .htaccess` and then paste in above. REMEMBER, to change the port accordingly

 IF you run above command as root, the new file will have root permissions. That isn't ideal. Instead you should make sure the .htaccess file has serverpilots permissions. That can be done by running this command: 

\`chown serverpilot:serverpilot .htaccess\` 

⑤ Start ghost by using this command in the public directory:   
  
`npm start --production`

## THE GOTCHA'S

**App Name** \- Choose a name that won't change later as you will NOT be able to change it. You'll have to delete the app and create a new one and when you delete an app Serverpilot deletes the entire app directory including all files that you have uploaded.

---

**Starting Ghost** \- The command `npm start --production` only starts ghost from command line. It won't make sure that Ghost runs persistently after reboots. So follow these instructions to run Ghost persistently, including after server reboots:   
  
[How To Startup Ghost On Ubuntu 16.04 and Ubuntu 14.04 And Keep It Running](https://ghost.skillshub.info/how-to-startup-ghost-on-ubuntu-16-04-and-ubuntu-14-04-and-keep-it-running/)   
  
(article will be posted on January 26th)

---

## ADDITIONAL INFORMATION

### Installing Ghost From Scratch

If you are installing ghost from scratch follow this tutorial:  
[https://www.ghostforbeginners.com/how-to-install-ghost-on-ubuntu-server-12-04/](https://www.ghostforbeginners.com/how-to-install-ghost-on-ubuntu-server-12-04/?ref=ghost.skillshub.info)

That will work fine as long as you **remember the caveats mentioned above**, about not touching apache nginx web server files by yourself. Also, make sure you are installing the correct version of node.js.   
 Ghostforbeginners tutorial may be a little outdated and is using older install scripts.

You might want to read this other article I wrote about connecting your server with ServerPilot - [Managing a DigitalOcean Server With ServerPilot](https://ghost.skillshub.info/managing-a-digitalocean-server-with-serverpilot/)

**Reference Links:**  
[https://serverpilot.io/community/articles/how-to-run-apps-in-any-language.html ](https://serverpilot.io/community/articles/how-to-run-apps-in-any-language.html?ref=ghost.skillshub.info)  
[https://www.ghostforbeginners.com/how-to-install-ghost-on-ubuntu-server-12-04 ](https://www.ghostforbeginners.com/how-to-install-ghost-on-ubuntu-server-12-04/?ref=ghost.skillshub.info)  
[http://support.ghost.org/supported-node-versions/ ](http://support.ghost.org/supported-node-versions/?ref=ghost.skillshub.info)  
[Managing a DigitalOcean Server With ServerPilot](https://ghost.skillshub.info/managing-a-digitalocean-server-with-serverpilot/)