October 14, 2013

Beginner

How To Use the DigitalOcean Ghost Application

Tagged In: Nginx, Ubuntu, Ghost



An Article From Ghost
Submitted by Hannah Wolfe

Introduction


Want to create a simple to use and beautiful blog with Ghost? Thanks to DigitalOcean's one-click "application" installation, you can create a droplet with Ghost pre-installed, running and ready to go in just a few short minutes!

The instructions below will take you from zero to blog, but they do assume that you already have an account with DigitalOcean. If you haven't, then head on over to the sign up page.

Step 1: Create a Ghost Droplet


In your DigitalOcean control panel, press the Create Droplet button, to be taken to the creation screen.

Droplet Hostname: You'll first be asked for a "hostname" - this is the name of your Droplet so you can identify it if you have a few. The name should not contain any spaces or special characters.

Select Size: There are 6 size options, but the smallest 512MB should be plenty for the majority of blogs. If you run out of resources, you can always upgrade later.

Select Region: Choose the region closest to you, or to your target audience.

Select Image: This is the important part! Under 'Select Image' choose 'Applications' and then select 'Ghost on Ubuntu 12.04'.

Ghost You're nearly there! Hit the big green 'Create Droplet' button, and a new Droplet will be created for you, with all of the things you need to run Ghost - such as Node.js, nginx and including Ghost itself - already configured and setup.

Creating a new droplet Once your Droplet is ready, you'll see a screen like this one:

Droplet ready If you open the IP address - which is 162.243.43.52 in the example above - in your favourite browser, you'll see your new Ghost blog is already up and running!

Step 2: Setting up a domain name


You now have your very own Ghost blog, but accessing it via an IP address probably isn't what you want. There are 3 steps to setting up a custom domain.

  1. Change the nginx configuration to match your domain name.

    In your control panel, select your droplet, and choose 'access', then press the 'Console Access' button. Once your console loads you'll need to log in. You should have received an email from DigitalOcean with the login details for your new droplet.

    Type nano /etc/nginx/conf.d/default.conf to open the nginx config file for editing in the nano editor. Change the current server_name from my-ghost-blog.com to your domain name.

    nginx config

    Note on using nano: Use the arrow keys to move the cursor around not the mouse. When you're finished, press ctrl + x to exit. Nano will ask you if you want to save, type y for yes, and press enter to save the file.

  2. Edit the Ghost configuration file

    Still in the control panel, enter nano /var/www/ghost/config.js to open the Ghost configuration file for editing.

    The Ghost config.js file contains configuration for different environments, your Droplet is automatically configured to run in production mode. Production mode comes second in the configuration file, after development mode. Move down the file until you find the production url setting, and change this to your domain name.

    Ghost config

    There are several other options in this file which can be configured, see the Ghost usage documentation for more information.

  3. You'll need to follow DigitalOcean's instructions on how to point your domain name at your server.

Step 3: Get Blogging


Browse to your newly configured blog, and then change the url to your-url/ghost. You'll see the Ghost sign up screen. Enter your details to create your admin user account. You'll be automatically logged in when you're done.

Ghost signup

Once you've logged in, you'll be taken to the Ghost content screen. You'll see a welcome blog post, and a green + button. Press that button to get started writing your first blog post in Ghost.

Maintaining your blog


You now have a fully working Ghost blog. Your Ghost Droplet is setup to make it as easy as possible to look after your blog in the long term.

Starting and stopping Ghost

Under certain situations, such as installing themes or upgrading, you may need to start, stop, or restart your Ghost blog. You can do this by using the start, stop and restart commands provided by the Ghost service. For example, after installing a theme, you can restart Ghost by typing service ghost restart. To see the current status of your Ghost blog just type service ghost status.

Upgrading Ghost (updated as of Ghost 0.4)

  • First you'll need to find out the URL of the latest Ghost version. It should be something like http://ghost.org/zip/ghost-latest.zip.
  • Once you've got the URL for the latest version, in your Droplet console type cd /var/www/ to change directory to where the Ghost codebase lives.
  • Next, type wget http://ghost.org/zip/ghost-latest.zip
  • Remove the old core directory by typing rm -rf ghost/core
  • Unzip the archive with unzip -uo ghost-latest.zip -d ghost
  • Make sure all of the files have the right permissions with chown -R ghost:ghost ghost/*
  • Change into your Ghost directory with cd ghost, then run npm install --production to get any new dependencies
  • Finally, restart Ghost so that the changes take effect using service ghost restart

Conclusion


DigitalOcean's one-click application feature (and the image created by Sebastian Gierlinger) makes it incredibly easy to get started blogging with Ghost. This article details 3 steps, but Ghost is running and ready for you to add blog posts by the end of the first, head over to the Ghost Guide for more information on how to get the most out of Ghost. We hope you enjoy blogging with Ghost, and continue to find maintaining your Ghost installation on DigitalOcean straightforward!


Share this Tutorial

Vote on Hacker News

Try this tutorial on an SSD cloud server.

Includes 512MB RAM, 20GB SSD Disk, and 1TB Transfer for $5/mo! Learn more

Create an account or login:

59 Comments

Write Tutorial
  • Gravatar sshyuann 6 months

    Thank you very much for this tutorial! :)

  • Gravatar dablog 6 months

    DO is so wonderful to support Ghost so quick!!

  • Gravatar planzz4 6 months

    Just what I was looking for thanks.

  • Gravatar jason.woj 6 months

    Thanks. Two questions: 1. Is the nginx default.conf file supposed to have anything in it to edit? Mine is empty. If that is standard, could you post the code instead of screenshot so I can cut and paste into editor or terminal? 2. I have no files in var/www. My Ghost was installed in home/ghost/ghost with config.js in there. Is there a problem with my instance if there is no var/www directory?

  • Gravatar bhofmann 6 months

    @jason.woj: If you log in with a terminal, you get the following message in the greeting: -------------------------------------------------------------- Welcome to the DigitalOcean Ghost Image! Ghost is installed to /home/ghost/ghost and can be accessed by visiting http:// in your web browser. You can stop and start Ghost by utilizing the ghost.conf upstart script. "start ghost", "stop ghost" and "restart ghost" are all supported. Ghost's default configuration can be modified by editing /home/ghost/ghost/config.js. You can read more about these settings @ https://github.com/TryGhost/Ghost/wiki. To change any nginx settings you can modify the ghost virtual host located @ /etc/nginx/sites-enabled/ghost. --------------------------------------------------- So, i think Hannah should Reflect this changes in the above tutorial. HTH, Bernd

  • Gravatar jchan.is 6 months

    Great tutorial. Is there any way to use Ghost with another Node.js web application on DO?

  • Gravatar Christina 6 months

    So I think D.O. changed the image. The original image I installed last night was in the /home/ghost/ghost folder but I was playing around with stuff, blew that droplet away and as of this afternoon (10/15), the new image is in /var/www/ghost (which frankly makes more sense) and has the standard Ubuntu terminal screen and not the Ghost specific version. IE, Hannah's instructions work with the current droplet, but may be slightly different for the original droplet.

  • Gravatar info 6 months

    I've restarted my server and now I cannot start the ghost service anymore, it just doesn't start... If I go to my url (wiert.io) I get a Bad Gateway error... any ideas?

  • Gravatar info 6 months

    Got it, the order is very important... So configure before you register...

  • Gravatar tobias 6 months

    Hmm... I have the same problem. Going to try commenting out the mail settings from the config.js file and rebooting the server. Annnnd... that worked. For some reason.

  • Gravatar belcherj 6 months

    How do I add a second site to a Ghost DO box? I have added the second domain to the DNS and it is pointed at the correct box. I created a var/www/domain2.com/public_html folder and update the permissions to www-data:www-data. Then edited my default.conf adding a second server block: server { listen 80; server_name domain1.com ; location / { proxy_pass http://localhost:2368/; proxy_set_header Host $host; proxy_buffering off; } } server { listen 80; server_name *.domain2.com ; root /var/www/domain2.com/public_html; index index.html; }

  • Gravatar belcherj 6 months

    Did not state what the problem was. Oops. The second domain is being directed to the Ghost blog. Domain2.com shows the Ghost blog.

  • Gravatar belcherj 6 months

    The '*' in the second domain was causing the issue.

  • Gravatar marc 6 months

    HA! Fantastic, worked like a charm with a brand new domain name!

  • Gravatar Joachim Pileborg 6 months

    While this is nice and quick, what is the email settings for the installation? I can't use the console or SSH from work, so no use at the moment in me creating a droplet just to check.

  • Gravatar lukeasrodgers 6 months

    Thanks for the tutorial. One minor emendation: it appears that when creating the first (and only) user account, you need to head to url/ghost/signup, not just url/ghost.

  • Gravatar khena0225 6 months

    Hi guys! I created a short video tutorial on how to setup your droplet with DigitalOcean. http://www.thatghostblog.com/how-to-install-the-ghost-platform-on-digitalocean-video/ I hope you all like it, and subscribe to my channel for more tutorials soon!

  • Gravatar jarace87 6 months

    I believe you are missing a step in the "Upgrading Ghost" section... the second last step should be: "Run npm install to get any new dependencies" See this guide - http://docs.ghost.org/installation/upgrading/ The upgrade didn't work for me until I had done this.

  • Gravatar jamie 6 months

    I evidently didn't configure my blog correctly. I am getting the following error message. Any ideas what I'm missing? "hey stranger Looks like you haven't configured your blog url" http://my-ghost-blog.com/

  • Gravatar hadrian.blaq 6 months

    Jamie: If you've configured your domain name following the instructions above but still getting this error when clicking the Ghost icon or URL link, you may need to restart the Ghost application to force an update of the configuration data. Login to the console and at the command prompt type "service ghost restart" and that should do it. HTH

  • Gravatar Kamal Nasser 6 months

    @Joachim: See docs.ghost.org/mail/

  • Gravatar Kamal Nasser 6 months

    @lukeasrodgers: I believe it redirects you automatically to /ghost/signup (it was probably updated).

  • Gravatar hausofmike 6 months

    I am new to this whole thing, ive set up my blog in development mode and am considering going live. The tutorial above seems doable but I cant get my head around one thing. Price. To get your blog live do you need to pay for both a digial ocean droplet and a custom domain name? Or will buying digital ocean give you a domain name. Please help :)

  • Gravatar Kamal Nasser 6 months

    @hausofmike: You will need to buy a domain name from a registrar such as Namecheap. Once you've done that, take a look at https://www.digitalocean.com/community/articles/how-to-set-up-a-host-name-with-digitalocean

  • Gravatar eckard.ritter 6 months

    Thanks, Jamie, it worked for me!

  • Gravatar pk.masiero 6 months

    Hi all, i can't find config.js (no such file or directory)...can you help me?

  • Gravatar hellomichaellee 6 months

    Thanks Digital Ocean team for creating such an awesome service and creating this easy one-click install. I've made a video that guides through each of the one-click install process. Hope this helps folks as much as this tutorial has helped me in getting Ghost up and running on my droplet. http://www.simplesetup.co/ghost-blogging-platform-digital-ocean/

  • Gravatar Kamal Nasser 6 months

    @pk.masiero: What command are you trying to run?

  • Gravatar raymondduke 6 months

    This is simple, if you have prior knowledge of databases and whatnot. For average people, it's confusing. To me, this is a missed opportunity.

  • Gravatar sudhir 6 months

    Why am I being redirected to my-ghost-blog.com when I have alredy edited production section of config.js?

  • Gravatar Kamal Nasser 6 months

    @sudhir: Did you restart ghost after editing the config file?

  • Gravatar tony.brown.357 5 months

    This worked out nicely, I have a blog in a few minutes, got to love that.

  • Gravatar Harish Chouhan 5 months

    Can anyone tell me how to forward www domains to non www?

  • Gravatar Harish Chouhan 5 months

    ok Got the answer: server { listen 80; server_name www.domain.com; // $scheme will get the http protocol // and 301 is best practice for tablet, phone, desktop and seo return 301 $scheme://domain.com$request_uri; }

  • Gravatar Harish Chouhan 5 months

    Way to forward www domains to non www domain - http://discoverghost.com/domain-forwarding-with-nginx/

  • Gravatar joshua.munoz.1988 5 months

    So, definitely having an issue with the my-ghost-blog thing. I've edited the URL in my ghost config, but it still says my-ghost-blog when I refresh the page. I've restarted Ghost using the service restart ghost command, force refreshed the page, but still, nothing. What am I missing?

  • Gravatar joshua.munoz.1988 5 months

    EDIT: Now I'm getting a 502 Bad Gateway. Let me give you some back story: I have my main URL, joshuamunoz.com, hosted on WestHost. I created a subdomain, write.joshuamunoz.com, in cPanel, and changed the IP to the IP address of my Ghost blog. From there, everything seemed to work except for the my-ghost-blog bit. When I changed the URL to the actual subdomain, I got the 502 Bad Gateway (probably because the DNS isn't actually pointing to Digital Ocean?). So what should I do? Is there a way to point a subdomain's name servers to a different DNS, so this can all work natively? Or am I screwed because I'm trying to use a subdomain in the first place and I'm essentially using hacks and trickery to try and get this to work?

  • Gravatar Kamal Nasser 5 months

    @joshua.munoz.1988: Try running ghost manually and see if it outputs any errors:

    cd /var/www/ghost;
    node index.js;

  • Gravatar swschulz 5 months

    How does one upgrade the copy of node.js on this image? I notice .22 is the current, and mine has .20 installed. It doesn't appear to be installed via a package (at least dpkg -l doesn't seem to show that). Just wondering if I should just download the new one and build by hand.

  • Gravatar Kamal Nasser 5 months

    @swschulz: I believe node.js is installed from a package in this image. Try

    sudo apt-get install nodejs

  • Gravatar swschulz 5 months

    @kamal Here's what I've found, which leads me to believe it is not: sudo apt-cache policy nodejs nodejs: Installed: (none) Candidate: 0.6.12~dfsg1-1ubuntu1 (which looks to be an old version and is not installed, yet node -v yields: v0.10.20 While this is only two versions off current, I still like to stay up to date if possible.

  • Gravatar Kamal Nasser 5 months

    @swschulz: Hmm. What's the output of sudo find / -iname '*nvm*' 2>/dev/null?

  • Gravatar swschulz 5 months

    Nothing found, same for 'which nvm' dpkg -l | grep -i node yields only udev. I'm guessing it was simply installed from source without using checkinstall, and the creator of the image much simply have specified /usr for the pieces instead of the default /usr/local.

  • Gravatar johnjameswhitman 4 months

    So I wasted a lot of time trying to figure out how to make the authenticated portions of the blog SSL. If you're connecting from anywhere other than a trusted private network consider doing the following: 1. Modify the default Iptables (firewall) config to allow connections on the HTTPS port (443) by adding the following line just below the one for port 80 in /etc/iptables/rules.v4: -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT (I got tripped up on this for a while) 2. Generate some self-signed certs (or get them from an SSL provider) [1]: sudo mkdir /usr/local/nginx/ssl # Create a spot to hold your certs cd /usr/local/nginx/ssl sudo openssl genrsa -out server.key 2048 # Create key openssl req -new -key server.key -out server.csr # Fill out fields, paying attention to the 'Common Name' which should match your FQDN/hostname or public IP openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt # Create certificate sudo chmod -R 700 /usr/local/nginx/ssl # Make sure your certs are only readable by root 3. Modify your blog's Nginx config to enable an HTTPS server and redirect requests at /ghost/ to HTTPS in /etc/nginx/conf.d/default.conf: ssl_certificate /usr/local/nginx/ssl/server.crt; ssl_certificate_key /usr/local/nginx/ssl/server.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP; ssl_prefer_server_ciphers on; server { listen 80; server_name myblog.com; client_max_body_size 10M; location /ghost/ { return 301 https://$server_name$request_uri; } location / { proxy_pass http://localhost:2777/; proxy_set_header Host $host; proxy_buffering off; } } server { listen 443 ssl; server_name myblog.com; ssl on; client_max_body_size 10M; # Enable SSL, link to the self-signed cert and key location / { proxy_pass http://localhost:2368; proxy_set_header Host $host; proxy_buffering off; } } 4. Restart Nginx and IPtables: sudo service nginx restart sudo /etc/init.d/iptables-persistent restart sudo service networking restart [1] Pulled from: https://ghost.org/forum/everything-else/2511-how-to-enable-secure-ssl-signin-for-ghost-with-nginx-on-debian

  • Gravatar johnjameswhitman 4 months

    Quick followup to my above post. Make sure you're proxying to the right port for your Ghost application (I'm running more than one) in /etc/nginx/conf.d/default.conf (default is 2368, I'm showing different ports for my http and https server blocks).

  • Gravatar jitendra.web 4 months

    I followed everything but RSS link (in footer) is still going to http://my-ghost-blog.com/rss/

  • Gravatar lqhart 4 months

    Hi, I got ghost up and running but I want to change the port I use to connect to my droplet via ssh (similar to the example here: https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04 I have followed the example several times when I install ghost from scratch and everything works great. But when I used the ghost app installation and go into sshd_config and change my port, then reload ssh and try to re-connect using the new port via putty, it never gets to the point where I can enter my login. Instead I get network error: connection timed out. Any suggestions? maybe firewall related? Thanks!

  • Gravatar lqhart 4 months

    Addition to comment December 28th, 2013 16:19 Not sure if it matters but I am doing everything as root.

  • Gravatar Kamal Nasser 4 months

    @lqhart: Do you have a firewall configured on your droplet?

  • Gravatar Kamal Nasser 4 months

    @jitendra.web: Try clearing your browser's cache—does that fix it?

  • Gravatar sean.foley.tech 3 months

    You should never ever use self-signed certs especially with Start SSL being free for a basic server cert with 1 domain (www and non-www). Users are smarter and if they don't see green locks you may have a problem. I would love to come back to Ghost, but it seems way too beta for me right now. Especially with Wordpress and Nginx working so well together. When Ghost pukes out errors they're nearly indecipherable, but thumbs up for trying to get a good tut up here.

  • Gravatar john 3 months

    I needed to run >sudo reboot now in order to get the my-url links changed within ghost.

  • Gravatar altonius 3 months

    Just a quick call out that the SSL configuration by johnjameswhitman is very weak. If you configure it per the above config you might want to run your site through https://www.ssllabs.com/ . At a minimum i'd change the following: replace "replace ssl_protocols SSLv3 TLSv1;" with "ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;" replace replace "ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;" with "ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK;" A really good article for ssl on nginx can be found at replace https://jve.linuxwall.info/blog/index.php?post/2013/10/12/A-grade-SSL/TLS-with-Nginx-and-StartSSL THe Cipher Suites are taken from the Mozilla recommended cipher suites - https://wiki.mozilla.org/Security/Server_Side_TLS

  • Gravatar luklau88 3 months

    Need some help: I got "cannot connect to server blog.catalyzingagility.com" after I modified "nano /etc/nginx/conf.d/default.conf", and changed the host name to "blog.catalyzingagility.com". But when I change it back to my-ghost-blog.com, it started working again. Did I do something wrong? cheers

  • Gravatar Lin Song 3 months

    @luklau88 Did you forget to change the "url:" to your blog's hostname in config.js? To all: I wrote up a tutorial summarizing the information on how to install and configure Ghost 0.3.3 on Ubuntu with Nginx and ModSecurity, set up SSL with a free StartCom certificate, add Disqus comments, as well as correctly adding robots.txt to your site and generating a sitemap. I hope you will find it helpful! Please copy & paste this URL in your browser: https://blog.ls20.com/install-ghost-0-3-3-with-nginx-and-modsecurity/

  • Gravatar dlehman 2 months

    When you use the one-click installer for Ghost, is there any way to figure out the password for the (unix) "ghost" user that the app is installed for? ie. i'm trying to add new css files to my theme folder Am I just missing something obvious?

  • Gravatar Kamal Nasser 2 months

    @dlehman: I don't know what the password is but if you're connected as root or as a user with sudo access you can switch to that user or change its password:

    sudo su ghost
    #change password:
    sudo passwd ghost

  • Gravatar pjmj777 about 1 month

    @Kamal Nasser @lqhart I'm having the same issue with changing the ssh port and having the connection time out. I'm using a fresh install of the DO ghost app server, so I'm not sure what's been configured firewall wise.

  • Gravatar Kamal Nasser about 1 month

    @pjmj777: How are you changing the ssh port? Log in to your droplet via the remote console and run

    sudo netstat -plutn
    -- is ssh running?

Leave a Comment

Create an account or login:
Ajax-loader