-
Notifications
You must be signed in to change notification settings - Fork 5
5. Getting a domain with DuckDNS
In this tutorial you will use DuckDNS to get a domain for your site, which will make the URL to your server easier to remember, and keep the same URL if your external IP changes for some reason. A domain is also required for HTTPS.
-
These instructions are written for Debian-based Linux distributions (Debian, Ubuntu, Raspbian...). You may need to change some of the commands for them to work in other Linux distros, and Windows is unsupported and will most likely not work.
-
You need a Hermes server already running through Nginx and port 80 open in your router in order to follow these instructions! Follow guides #1, #2, #3 and #4 to get this.
You should get a domain for your site. To get one you can use DuckDNS, which will give you other advantages such as keeping the same web address even if your IP changes.
To create one, create an account on https://duckdns.org.
When you have registered, you will see a page like this one.
Create a subdomain on the site. Remember to save the token shown on the page, you will need it in the next step.
Enter these commands on your server:
mkdir ~/Scripts && cd ~/Scripts
nano DuckDNSThis will open a text editor, into which you should paste this in (Replace DOMAIN and TOKEN for your own):
DOMAIN="exampledomain"
TOKEN="00000000-0000-0000-0000-000000000000"
echo url="https://www.duckdns.org/update?domains=$DOMAIN&token=$TOKEN&verbose=true" | curl -k -o ~/Scripts/DuckDNS.log -K - Once you have done this, press CTRL + X to exit and Y to save your changes. Then paste in these commands:
chmod 700 DuckDNS
./DuckDNS
cat DuckDNS.logAt the end of the terminal output, you should see "OK" printed. If you don't, check that your domain and token are correct.
At this point, if you go to {DOMAIN}.duckdns.org, you should be able to access your Hermes server.
Right now, you have a domain which forwards to the IP of your server. However, if the IP changes for some reason, the domain won't be able to connect to it. Now we will make the server update the active IP address every 5 minutes using cron so this doesn't happen.
Enter this command on your server:
crontab -eIf it asks you to choose an editor, select nano, it's the one we have been using throughout the entire tutorial.
You will enter a text editor. Go down to the bottom of the file, and paste this in:
*/5 * * * * ~/Scripts/DuckDNS>/dev/null 2>&1
This will run the update script every five minutes.
You should have your own domain to host Hermes on!
- If you don't, go back and make sure you did everything correctly.
- If you do, you can continue to the next step
