Skip to content

Commit

Permalink
Added post about hosting the blog, obfuscated my email.
Browse files Browse the repository at this point in the history
  • Loading branch information
gburgett committed Dec 15, 2014
1 parent 4c27f02 commit 60b1759
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion content/post/creating a blog.md
@@ -1,6 +1,6 @@
+++
date = "2014-12-14T13:52:12-06:00"
draft = true
draft = false
title = "Creating a blog"

+++
Expand Down
30 changes: 30 additions & 0 deletions content/post/hosting the blog.md
@@ -0,0 +1,30 @@
+++
date = "2014-12-14T18:42:21-06:00"
draft = false
title = "hosting the blog"

+++

I decided to use Amazon EC2 to host the blog, because they give you 1 year free on a micro instance. Plus I've always wanted to learn how to host something on Amazon's cloud. I'll get a linux instance and put an Apache HTTP server on it. Should be easy enough to do.

Here's my EC2 management console after signing up for an Amazon account and creating a linux micro instance:
![EC2 Management console](/images/EC2 management console.png)

It took a bit to then be able to log in. I had to add a security group that allowed SSH login, then used my ssh key generated by Amazon to ssh into the instance. It gave me an error, 'permissions are too open', so I had to change the key permissions to only be readable by my user: `chmod 400 ~/.ssh/macbook.pem`.
![SSH login to instance](/images/ssh login to ec2.png)

Adding Apache HTTP turned out to be easier than I thought. The linux AMI comes preinstalled with Yum, which is a linux package manager. I just had to `yum install httpd`, then start up the service. I followed this tutorial: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

The main gotcha was I hadn't yet added a security group to allow HTTP traffic to my instance. That was fairly easy and fortunately the tutorial pointed it out. I admit I don't understand all the linux-ese but the tutorial fortunately explained what was going on.

I had to change the hostname and regenerate the site. I suppose I'll try to modify the theme so that it's less dependent on the hostname, but I think it will be easier to just codify that into a deploy script. Generating the site looked like this:

`hugo --baseUrl="http://ec2-54-149-156-115.us-west-2.compute.amazonaws.com" --theme=hugo-uno`

I then copied the files from the 'public' folder to /var/www/html on the server using scp. Here's the command:

`scp -i ~/.ssh/macbook.pem -r ./ ec2-user@ec2-54-149-156-115.us-west-2.compute.amazonaws.com:/var/www/html`

After that I could navigate to http://ec2-54-149-156-115.us-west-2.compute.amazonaws.com/ in my browser and my blog worked! Hooray!

I'll probably code all that up into a deploy script, but I'll wait till I get the domain first.
Binary file added static/images/EC2 management console.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/ssh login to ec2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion static/js/custom.js
Expand Up @@ -2,7 +2,8 @@ $(document).ready(function(){
$('#email').click(function(evt){
evt.preventDefault();

var e = 'gordon' + '.burgett' + '@gmail' + '.com';
var at = '@';
var e = 'gordon' + '.burgett' + at + 'gmail' + '.com';
var link = $('<a>').attr('href', 'mailto:' + e).text(e);
$('#email').empty();
$('#email').append(link);
Expand Down

0 comments on commit 60b1759

Please sign in to comment.