Ghost, Nginx, 502, and Port Problems

Got myself into a problem trying to install Ghost 0.4.2 on a Digital Ocean Droplet with node 0.10. I used the Dokku Droplet (instead of their Ghost setup) because I’d like to install multiple node apps with different domains.

I git cloned the stable Ghost release and followed the instructions they gave to set it up: npm install -g grunt-cli npm install grunt init (and grunt prod if you want to run Ghost in production mode) npm start

I’ve changed my config.js file (the production part) to

    url: '',  
    mail: {},
    database: {
        client: 'sqlite3',
        connection: {
            filename: path.join(__dirname, '/content/data/ghost.db')
        debug: false
    server: {
        // Host to be passed to node's `net.Server#listen()`
        host: '',
        // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
        port: '2368'

When I use port 2368, it says that “Ghost is running… Your blog is now available on

But then it gives me a 502 error.

Ok, when I change the production port to 80 (one article suggested this), it throws this error:

events.js:72 throw er; // Unhandled ‘error’ event ^ Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at net.js:1143:9 at dns.js:72:18 at process._tickDomainCallback (node.js:459:13) at process._tickFromSpinner (node.js:390:15) npm ERR! weird error 8 npm WARN This failure might be due to the use of legacy binary “node” npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

I’m guessing this means that port is already in use.

Ok, so here’s another part I don’t understand. Many sites mention trying “sudo service ghost restart”. I always get “ghost: unrecognized service” to this. It’s odd because everything is in place and the developer instructions they gave (see the top of this) worked well for installing it. But my system doesn’t know it’s there.

Also, there doesn’t seem to be any /var/www/ghost file. Not sure what that means.

I’ve sleuthed and googled but can’t seem to figure this out. Any hints or tips would be so appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Ok, thanks very much Andrew for your help.

It should. Dokku generates nginx configs for each app that are similar. It uses random ports, so the only problem I could imagine is if it randomly picked that port…

Ok thanks. Will that work if I use Dokku as well? It seems like Dokku is a good idea for having multiple apps on one VPS.