Topic: Add Your Kete Application to /etc/hosts or via ghost gem

Topic type:

Set up a local (your host only) DNS entry for your Kete application. Useful for development and demonstration Kete applications.

Originally written by Walter McGinnis, Kete Project Lead for Katipo Communications, Ltd.

 

An appendix of the Installation Guide

When in development or doing a demo on our local machine, I find it a nice convenience to able to support different hostnames for different projects listening on port 80 like normal web requests rather than localhost and a port number.

Using Ghost Gem (for *nix based OS's - linux/mac)

If editing a system file something you don't want to do, then there a tools that can do a similar job without touching the hosts file.

Firstly, make sure Ruby is installed. Secondly, install B Jeanes Ghost gem:

$ sudo gem install ghost

For conveniance, also add this to your .profile or .bash_profile files:

alias hosts='ghost'

Then type 'hosts' into the command line for instructions.

Using the examples in the first section, you would then just type

ghost add your_hostname

and it will automatically setup 'your_hostname' to point to localhost without you having to edit any files manually.

Alternative: Configure /etc/hosts

Important Note: This step assumes that you have correct privileges to edit the /etc/hosts file on your host.

As long as your webserver configuration match the hostname you want to use, you simply need to edit /etc/hosts (with root permissions) and add an entry on it's own line right after the locolhost entry. Like so:

...
127.0.0.1 localhost
127.0.0.1 your_hostname
...

"your_hostname" should be the address for the Kete application, as in your /usr/local/nginx/conf/nginx.conf server_name setting. Thus if you put "127.0.0.1 my.domain.com" in /etc/hosts, all requests from your host to "my.domain.com" would point back at your host. You can, of course, do this for multiple hostnames.

Discuss This Topic

There are 0 comments in this discussion.

join this discussion

Creative Commons Attribution-Share Alike 3.0 New Zealand License
Add Your Kete Application to /etc/hosts or via ghost gem by Walter McGinnis is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License