How to Setup a Ghost Blog on Amazon AWS EC2

Ghost blog Setup on AWS EC2

Want to launch a Ghost blog on AWS? This guide covers setting up an EC2 instance, installing Ghost, and configuring security in easy steps. Learn to quickly deploy a fast, secure Ghost blog on Amazon’s cloud.

After an extended past-due refresh, I have recently moved this blog to Ghost CMS. Overall, I was very impressed. Ghost is straightforward to apply as an editor, quick to make updates, and the Ghost crew is constantly pushing out updates – which is tremendous considering that it’s miles completely open supply.

In order to get began with Ghost, I currently use the AWS loose tier and run this weblog on a Micro example. Considering this is the smallest instance to be had, I had been very inspired by the overall performance of this site. I additionally selected to go together with the Bitnami Ghost stack for AWS so that it will arise and jogging as quickly as feasible.

While Ghost has been ticking away properly, I have these days been having a few extreme problems with my Amazon EC2 instance and I desired to put in writing this newsletter to assist any others that are probably experiencing the identical hassle! I’d also want to refer lower back to this in case it occurs to me again.

AWS Instance scheduled for Retirement

As a long way as I was concerned, my weblog was up and going for walks and the whole lot became working as anticipated. After about 3 months of strolling undisturbed, I acquired a warning from AWS that my “instance turned into scheduled for retirement due to underlying hardware degradation and that it could already be unreachable”. What!?

Sure enough, I logged in to the Amazon management console and it changed down. My blog was additionally returning a 503 Service Unavailable error. Fortunately, I became capable of stopping the example and restarting it once more – but this supposed I had to backup my blog and restore it to every other instance.

Wait…You don’t again your blog up again!? Yeah, I realize….Rookie mistake!

Make a Backup of your Ghost Blog

There are approaches to make a backup of your Ghost weblog on EC2. The first alternative is to create a photo of your EC2 instance which you can absolutely use to restore from any factor in time. Think of it as a “picture” for the given time.

If you log into the AWS console, select Instances after which pick the instance you want to back up.

Next, pick Actions -> Image -> Create Image.

Making a Backup of Ghost Blog
Making a Backup of your Ghost Blog

This will then create AMI beneath photographs that you could use to repair from. You can without a doubt select Launch Instance after which appearance under My AMIs to restore your newly created picture.

You could even take this a step further and automate the complete procedure so you have an up to date picture to restore from at any point. Using a Cloudwatch event, you could take a scheduled photo of your example. I gained’t cross into it in this newsletter, as that is a piece of writing in itself – however please comply with the hyperlink above for extra info.

The 2d alternative is to manually backup your blog using the UI for your Ghost weblog. This choice is good if you are trying to restore to a completely clean, new edition of the Bitnami Ghost photograph. You’ll need to begin by way of exporting all the content to your weblog. Log into your admin interface, and head over to Labs.

ghost blog export content

Choose Export your Content, and it’ll download all your posts and settings in a single JSON report.

If you have any redirects or routes set up to your Ghost weblog, you may do that in an equal manner.

ghost blog redirects and route

We are almost finished – next, you’ll need to take a backup of the design of your blog. Head over to the Design tab in your admin interface.

export ghost design

From there, click on the download link and you’ll receive a ZIP report containing all the belongings that make up the layout of your web page.

The first-rate factor about the Ghost admin interface is that it lets you import the whole thing back in the same manner. If you’ve got some other example up and jogging, log into the admin interface and add all the exported content material that you have. Nice and clean!

Backup the pictures on a Ghost blog

Now this is all right and proper, however the eagle-eyed among you might have noticed that we haven’t sincerely downloaded any of the photographs associated with the blog. You would possibly have restored all of the content material for your new example, but in case you visit the pages on your website online, you could notice that your photos now point to broken hyperlinks!

At the instant, the Ghost admin interface doesn’t let you download a replica of all your pix. Fortunately, there’s a way around this, although it’s a bit of a pain. All of the photos on your Bitnami Ghost blog are positioned at

~/apps/ghost/htdocs/content material/snapshots’.

I transfer between Windows and a Mac – so I used PSCP on a Windows device for the command beneath. However, the command of the usage of SCP in Linux is almost equal. I started by downloading all of the pics on my blog to my nearby machine.

pscp -r -i C:\Users\dhume\Documents\xxx.ppk bitnami@xxx.compute-1.amazonaws.com:/home/bitnami/apps/ghost/htdocs/content/images C:\dean 

Let’s break this down a bit. Firstly, I am strolling the PSCP command and am linking to the “.ppk” report with my login credentials. Putty SCP uses PPK rather than PEM, but you could easily create one the usage of the Putty device.

Next, factor into the EC2 instance that I need to replicate the pictures from, in addition to the course to the pictures on the EC2 example. The last parameter points to the folder on my neighborhood gadget.

After walking this command, I can see that each one of the pix had been downloaded to my local pressure.

export image ghost blog

Restore Photos on a Ghost Blog

So some distance is so good! Our Photos have been downloaded onto the local force however we still need to upload them to the new EC2 instance. Using a similar command to the one we used above, I now want to flip the command and factor to the new EC2 instance.

pscp -r -i C:\Users\dhume\Documents\xxx.ppk C:\dean\images\2018 bitnami@xxx.us-west-2.compute.amazonaws.com:/home/bitnami/apps/ghost/htdocs/content/images/

If all runs successfully, you should now see the photos to your website!

Remove the ‘manipulate’ banner on a Ghost Blog

If you spin up a brand new Bitnami Ghost example, there are still some matters that you need to do earlier than the web site is prepared to go ‘live’. In a very clean example, you can be aware of a banner in the bottom right-hand corner when you view your site in a web browser.

In order to remove this, you’ll want to SSH into your instance and run the subsequent command inside the terminal.

sudo /opt/bitnami/apps/ghost/bnconfig --disable_banner 1

If you refresh the web page, you’ll word that this has now been removed.

Update the Domain on a Ghost Blog

When you spin up a brand new Bitnami Ghost example on EC2, you’ll be able to get entry to it from the default domain that AWS assigns to it.

However, you’ll want to factor this to a real domain call and that involves updating a config setting so as for Ghost to link efficaciously.

In order to do this, you’ll want to SSH into your instance and run the following command.

sudo /opt/bitnami/apps/ghost/bnconfig --machine_hostname yourdomainname.com

It takes a little even as to complete running, but this command will replace your area thus. Provided you’ve updated your DNS details with your website hosting provider – when you go to the domain name on your website – all links will now be in operating order.

I have sometimes observed that the command above appends a :80 port number to the end of the domain call. This can mess with RSS feeds and links. In that case, you may always immediately edit the values in the config.Manufacturing.Json file the use of the subsequent command:

sudo nano /opt/bitnami/apps/ghost/htdocs/config.production.json

Update Ghost blog to the latest version

Considering Ghost is absolutely open source and constructed in large part by using the network, it’s quite incredible to peer the number of updates that they continuously deliver.

If you log into the admin Panel of your Ghost blog and click on About – you should observe something a touch like the photo underneath.

latest version of ghost cms

The Ghost admin interface intelligently helps you to recognize that you are on an older model and what new features are available in case you replace. Not extraordinarily, updating it less complicated than you observed.

Start off by SSH’ing into your example and navigate to /apps/ghost/htdocs. Next, you’ll need to run the following command.

sudo ghost update

If the whole thing runs effectively, you’ll have the trendy version of Ghost up and going for walks!

Stop and Start Ghost once more

I have noticed some times in which you all suddenly stumble upon a 503 error whilst you are going for walks an Amazon Micro example.

This might be induced due to having low reminiscence on the instance and Ghost struggles with this. I discovered that a brief prevention and beginning of Ghost needs to sort this hassle out too.

sudo /opt/bitnami/ctlscript.sh stop
sudo /opt/bitnami/ctlscript.sh start

Related Post: Top 10 SEO Tips for Ghost Blog 2024

Summary

That’s about it. I hope that this newsletter has been useful to you. As I experiment with Ghost and make modifications to this weblog, I will be sure to keep it up to date. Hopefully, this serves to help you, however, as a reminder for myself in case this happens again!

Dananjaya
Dananjaya

He is the Best Premium cookies provider and also the Owner of mmozape and more 5+ Free Premium Cookies websites. He does blogging and traveling in his free time.

Leave a Reply

Your email address will not be published. Required fields are marked *