Using the domains feature in 1999.io
by Andy Sylvester Tuesday, September 20, 2016

The 1999.io blogging tool has a feature supporting redirection of domains for a weblog. However, there are a few other steps that are needed to use the feature and have a URL that does not contain a port number. This post offers some tips in this area. I am using John Philpin's weblog URL as an example.

1.  Set up an A record

Using your DNS provider, create an A record pointing to the IP address for your server. Here is an example of what it would look like on my provider:

Domain: beyondbridges.net

Host record: river

Points to: 123.234.345.456 (fill in the IP address of your server here)

2. Enter command on your server to redirect port 80 to port 1999

The default setup of 1999.io is that the application runs on port 1999. Enter the following command in a terminal window on your server while logged in as root:

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 1999

Normally, when you go to a website like river.beyondbridges.net, the response comes over port 80. When this command is entered, the server will map port 80 to port 1999. This makes it look like your app is running on port 80, but it is really running on port 1999.

Reference: http://blog.1999.io/2016/05/07/0020.html

3. Updates to config.json

An addition to config.json is needed to use the domains feature in 1999.io. Here is an example of the text to add to your copy of config.json:

"where": {

       "flUseLocalFilesystem": true,

       "publicPath": "publicFiles/",

       "privatePath": "privateFiles/"

},

"domains": {

        "river.beyondbridges.net": "/users/jgphilpin"

},

Typical config.json setups should already have the "where" part, I just included it to provide a reference for where to add the domains entry. There is also an example config.json at the reference URL below.

Reference: https://github.com/scripting/1999-project/blob/master/docs/domains.md

4. Restart your server

After performing steps 2 and 3, you will need to stop your server and start it again.

I have an example server running on http://node2.andysylvester.com:1999 (my 1999 editing environment) and the redirected blog at http://newblog.andysylvester.com. The RSS feed is at http://newblog.andysylvester.com/rss.xml.

I would be interested in feedback from other 1999.io users on this topic - let's hear from you!