Suppose you have a website on example.com and you want to create a blog that points to blog.example.com. How do you do this? Well, assuming that you are using NGINX and using Linode for hosting, I am going to teach you just that.

Your NGINX Site Config

For me this is located inside, /etc/nginx/sites-available directory. I name each site config using its domain name. So, for our use case, that directory would contain two files, example.com and blog.example.com.

example.com site config may look something like:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
}

So, what about your blog.example.com site config. That would look something like:

server {
    listen 80;
    server_name blog.example.com;
    root /var/www/blog.example.com;
}

Requests that starts with blog.example.com will be served with assets under /var/www/blog.example.com.

I hope that’s pretty straight forward and obvious. But, doing this alone, will not give you what you want.

Adding A Record

This is the one thing that I forgot to do and I spent a while trying to figure out why the subdomain did not work.

Login to your Linode and select the server that’s hosting your website. Click on the DNS Manager tab. In there, assuming that you already set up the parent domain web site, you should have an entry for your website which you are creating a new subdomain for. Click Edit for that domain entry.

You should now see a familiar page that lists all DNS records. Find the section that lists A/AAA Records and click Add a new A record.

You should now see a form with 2 text fields (Hostname and IP Address) and 1 select input. For the hostname, enter blog.example.com and, for the IP address, enter the server’s IP address. Leave the select input alone. Click Save Changes and you are good to go.

Sorry for not having pictures. Feel free to send me e-mail/leave comment if you have questions though.

Simple Slide Out Navigation Menu in iOS with Swift (Part 2)

Continuing from part 1, we are going to see how to switch the displayed view controller when one of the menu selections is tapped Continue reading

Uh-oh. Where Is On Ready In Ember?

Published on January 05, 2015