After a couple months of moving, putting together IKEA furniture and reconfiguring servers and devices there is still one thing missing; a static IP. I am currently running OpenProject as my choice of project management tool. The challenge of using this is that it runs on Ruby, so it has to be hosted on one of my servers and these are placed in my apartment at the moment.

Normally, when having a static IP you would simply add a CNAME record for the IP and it would have been working as intended. At the moment this is unfortunately not the case. So how do we get around this?

In my case, only HTTP needs to be supported at the moment so the solution was making a simple PHP script handling the redirection. This stores the server IP on request and redirects everything else. It also handles subdirectories and GET requests correctly.

To use the script, create a folder with the desired name of your server( would be achieved by creating a folder named server1 in the root directory of your web host. Then all you have to do is extract the source in that directory and create a cron job on your server for updating the server IP. Remember to update your auth token in index.php.

Cron Job setup

Append the following content to your crontab:

*/10 * * * * wget -q -O /dev/null "https://<folder-name><your-auth-code>"

Save and exit.

Example usage

Manually update your server IP to your current public IP

Retrieve the server IP in a browser

Get your server IP in a terminal
$ echo Server ip is: $(curl -sL