Skip to content

Instantly share code, notes, and snippets.

@Congee
Created February 25, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Congee/16d1d67a43bbd7a14523 to your computer and use it in GitHub Desktop.
Save Congee/16d1d67a43bbd7a14523 to your computer and use it in GitHub Desktop.

Hmmmm, you may have noticed that DigitalOcean provides one-step ghost blog setup -- you can directly choose Ghost 0.4.2 on Ubuntu 12.04. But, as you see, it's 12.04 which may does'nt meet our needs.
E.g. its vim version is 7.3, compiled in 2011.

So, you may think: I should customize all by myself, and certainly I can make it. Then, you would have installed everything needed. As you cd ghost && npm start, only to find :

/usr/bin/env: node: No such file or directory
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

Huh, it's a piece of case. sudo ln -s /usr/bin/node /usr/bin/nodejs Again, cd ghost && npm start

/usr/bin/env: node: No such file or directory
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

WTF, still I got this err!
Common on~~~ give up and look here: DigitalOcean also provides node-v0.10.29 on Ubuntu 14.04
back up your files(don't forget dotfiles :) and creat a new droplet. restore your files from backup and cd ghost && npm start --production.
Yay!~ It works like a charm. But, how to give port 80 access to others? Nobody likes to visit a site by adding the redundant :2368. Follow me: don't change the port 2368 in your config.js and :

sudo -A INPUT -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT
sudo -A INPUT -i eth0 -p tcp -m tcp --dport 2368 -j ACCEPT
sudo -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 2368

Yeah, you don't need Nginx or Apache. Just three iptable rules to redirect port 80 to port 2368. Done.

PS. perhaps you can't test your site in this way curl localhost:80 or curl 127.0.0.1 on your VPS but other ends can have access to it. Change your iptables rules to allow INPUT from localhost on your VPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment