Thursday, January 21, 2016

Setting up webserver on RasPi

This shouldn't have been a headache, but it sure was!
The idea was:
1. Get a domain
2. Put my site content on RasPi
3. Profit
I'd recently moved to Singapore from Australia, so naturally a new router. I'm actually surprised by the amount of changes I needed to move from my previous DLink router to the new DLink router. Anyway this is what I ended up having:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

wireless-power off
allow-hotplug wlan0
auto wlan0

iface wlan0 inet manual
   wireless-essid 'MyInternetz'
   wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface home inet static
   address 192.168.0.250
   netmask 255.255.255.0
   network 192.168.0.0
   gateway 192.168.0.1

iface default inet dhcp

I'd actually struggled with stability with the RasPi. The keywords are "wireless-power off". The /var/logs/network said nothing about power saving...
So I go on to buy a domain off NameCheap, and learn a thing or two about CNAMEs. Hence I create one that points to my IP...oh hang on, I need a static IP which typically means I need to pay my ISP a few more dollars...lets not.

I set up NoIP and use their dynamic IP updater so I can set a hostname which points to my dynamic IP. This is where I then realize my ISP has some paranoia issues and blocked port 80! No problem, I'll setup a URL Redirect record in NoIP, then on NameCheap my CNAME can point to this URL Redirect. If only it were that simple, it doesn't look like CNAMEs can point to URL Redirects, not quite sure why this doesn't work...

Luckily, NameCheap have their own dynamic IP updater which I hadn't realized earlier, so I scrap the NoIP idea. This creates an A+ dynamic DNS record which points to my dynamically updated IP. Unfortunately, this still means I can't use port 80, because CNAMEs don't accept ports, and neiher does the dynamic IP updater...I've decided to live with specifying ports for now.

2 comments:

  1. Just saw this (old) post. Perhaps this is a solution for you: https://github.com/Eidansoft/namecheap-DDNS-Update

    ReplyDelete
    Replies
    1. Wow a docker container to do this, thanks for the info!

      Delete