Free Dynamic DNS: Remote Access to Home Server
Abstract: sudo service apache2 restartFix untrusted domain error on Nextcloud If you are able to successfully connect to the applications running on your home s
This tutorial explains how to setup Dynamic DNS (DDNS) to remotely access your home server with a free domain name! Using dynDNS, you can access any devices in your home network from anywhere in the world.
This page is still work in progress, for more information check out the video which is linked in the title image.
Forward ports to serverFind your standard gateway (if its not simply 192.168.1.1) by opening a new CMD command line and entering
ipconfig /all
Open your router settings, log in and find the 「port-forwarding」 section and forward port 80 and 443 to your home server
Best DynDNS service providerIn order to access your home server through a domain name, you will need to get an account with a DynDNS service provider. I usually recommend to go with https://dynu.com since they provide excellent service and are completely free to use.
After creating an account on Dynu, click on the 「DDNS Services」 option and create your first free DDNS domain name.
Note: If you own a domain name, you can just as well use that!
After creating a free domain name, Dynu should automatically use the he IPv4 address that you’re currently using to link to your domain name. If you have a static IP address, you can skip the next step.
Automatically update IP addressIf you have a dynamic IP address (which is the default with most ISP’s), your IP address will regularly change. Therefore, we need to periodically report our latest public IP address to Dynu in order to still be able to access our home server form outside of our local network. To this end, we need to create a new cronjob by opening crontab:
sudo crontab -e
and add a new Crontob by adding the following line
*/15 * * * * wget -O dynulog -4 "https://api.dynu.com/nic/update?hostname=example.dynu.com&myip=10.0.0.0&myipv6=no&username=someusername&password=somepassword"
Provide your hashed password, as can be obtained from https://www.dynu.com/NetworkTools/Hash
Setup subdomainsIf you want to provide access to multiple applications running on your home server, set up CNAME records under 「DNS Records」.
Apache Reverse Proxy ConfigurationTo access both your Nextcloud and Bitwarden instance running on your home server, you will need to configure Apache to work as a reverse proxy.
Open the Apache configuration file
sudo nano /etc/apache2/sites-available/000-default.conf
and enter virtual host entries. Following two examples for Nextcloud and Bitwarden:
<VirtualHost *:80>
ServerName YOURDOMAIN.giize.com
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
RewriteEngine On
RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/host-meta https://%{SERVER_NAME}/public.php?service=host-meta [QSA,L]
RewriteRule ^/\.well-known/host-meta\.json https://%{SERVER_NAME}/public.php?service=host-meta-json [QSA,L]
RewriteRule ^/\.well-known/webfinger https://%{SERVER_NAME}/public.php?service=webfinger [QSA,L]
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName SUBDOMAIN.YOURDOMAIN.giize.com
ProxyVia On
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
<Proxy *>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Proxy>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log example
</VirtualHost>
Next, you will need to enable a few Apache modifications and reload Apache
sudo a2enmod proxy proxy_http
sudo service apache2 restart
Fix untrusted domain error on Nextcloud
If you are able to successfully connect to the applications running on your home server using the free domain name from Dynu but you get the 「Access through untrusted domain」 error then you need to modify your Nextcloud configuration file
array (
0 => '192.168.1.xx',
1 => 'yourdomain.dynu.com',
),