As you might know, this site is created as a static website with Jekyll.
GitHub Pages in combination with Jekyll is a simple yet powerful tool to build and serve static websites.
However, by default you website will be located at username.github.io, e.g.,
http://drissamri.github.io for this page. Generously, GitHub provides means to add a custom domain to your GitHub Page.
There are a few limitations, but for me the only limitation that was bothering me that there is currently no support for SSL on custom domains. You can partly work around this problem by using a service like CloudFlare, although it won’t give end-to-end SSL it is definitely better than using no SSL.
Since I like Bluemix, IBM’s Platform-as-a-Service based on the open source Cloud Foundry, I decided to give it a shot to deploy my website and setup SSL on it. If you haven’t tried it yet, definitely do! You can get a 30-day free trial, and afterwards you can still use the free tier. The free tier is plenty to host a few applications. Since Bluemix uses Cloud Foundry, I will mix both terms throughout this post.
Deploy your application on Bluemix
I prefer to work with the Cloud Foundry CLI instead of the Bluemix website, but both ways work. If you’re scared of a terminal, feel free to use the website.
The most important artifact for a Cloud Foundry application is the
manifest.yml which defines metadata about your application. You can find the full manifest here.
name: Name of your application.
memory: Specify how much memory your application needs.
host: This defines the name for the subdomain (yourhost.mybluemix.net).
path: Specify what folder gets pushed. If not defined, defaults to the current directory.
buildpack: Specify what kind of buildpack your application needs.
stack: Bluemix currently defaults to an older stack (lucid64) so you better specify this if you are using a recent buildpack. More information here: Cloud Foundry stacks
Once you saved this file, you can use the Cloud Foundry CLI to push the application. Make sure you your Cloud Foundry CLI is pointing to the desired region (EU or US). Go ahead and get your baby in Bluemix with
Now your application should be available on
Setup your custom domain in Bluemix
I want my site to be available on
www.drissamri.be. There’s a few easy steps to do to accomplish this. If you are OK with using the default Bluemix URL of your application or you don’t have a custom domain, you can skip these steps.
First you will have to define your domain in Bluemix. Create the domain in Bluemix and associate it with an organization, in my case it’s
Now your domain is known within your organization, next you’ll want to map this domain to your application. Both my domain name and application name are called…
One of the reasons of moving my blog was to be able to enable and force SSL on my site. I already have a SSL certificate for my website, if you need one I can recommend SSLMate. By the time you are reading this, it might be worth checking out letsencrypt.org if they are already issueing certificates.
Unfortunately as far as I know, you can’t manage certificates with the Cloud Foundry CLI, so you’ll have to switch over to the Bluemix website. Navigate to the
Manage Organizations and go to the
Domains tab. Here you should see your newly created domain.
Perfect. Now you can upload the SSL certificate for this domain by clicking on the upload icon. Here you have to upload your private and public certifcates, and possibly an intermediate certificate.
Now Bluemix knows about your domain and your certificate, but the actual forwarding from your domain to the Bluemix application still has to happen. This has to be done on your domain DNS manager. My domain is registered at GoDaddy but I’m using the free CloudFlare plan for security and caching features. Your
A record should point to the Bluemix DNS server, the server IP depends on which region you are using for your application. For me currently in the EU I have to use
184.108.40.206 but you should verify in the documentation for up-to-date information.
One last thing, if you want to force SSL usage of your site on HTTPS, you have to add another property to your
manifest.yml. This is a feature of the staticfile-buildpack that we defined for our application.
That’s about it! Up and running on Bluemix with a custom domain in a few minutes. It’s been running pretty smooth so far.