How do I set up my apache server with DynDNS?

I have been trying to set up my apache server for many days now, to no avail. I have acquired a DynDNS Pro account and have also registered a domain name with names.co.uk (I haven't even figured out what to do with that yet, and if I even need it at all).

I've configured my sites-enabled folder in the /etc/apache2 directory to point to the directory where I have my .html documents. It works fine when I have DynDNS set up to the local IP Address 192.168.x.x. But I know that this means that other people can't access my website. When I go to the DynDNS website and change the IP address to what is my public IP, if I try to access my website "shredalert.homelinux.com" it takes me to the login page for my router. I am completely boggled as to why this occurs. This is my first time trying to set up a web server and website. Please have some patience if I make really silly comments/assumptions.

I should add that I have already forwarded port 80 for 192.168.x.x. How would I fix my apache server to load my website, instead of loading my router login page when I change my IP to my public IP address on DynDNS?

P.S. Would very much appreciate if someone who uses "names.co.uk" could tell me how I could utilise the domain name I have registered.

1 Answer

A few notes :

  • your domain's configured dns servers must point to dyndns
  • your router must forward port 80 to your local machine. The ip address on your local machine should be static and ideally reserved on the router.
  • your machine must have port 80 open
  • if all this is setup correctly, if you do you should get your default apache page (same as )
  • you must set a virtualhost for shredalert.homelinux.com to listen, or put that domain as alias of localhost with ServerAlias shredalert.homelinux.com directive on your main config file.

Create the virtualhost file /etc/apache2/sites-available/shredalert.homelinux.com.conf like :

<VirtualHost *:80> ServerName shredalert.homelinux.com DocumentRoot /path/to/root/directory ErrorLog "/var/log/apache2/error.shredalert.homelinux.com.log" CustomLog "/var/log/apache2/access.shredalert.homelinux.com.log" common <Directory /path/to/root/directory> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all Require all granted </Directory>
</VirtualHost>

Then enable the site and restart (or reload) apache2 service

sudo a2ensite shredalert.homelinux.com.conf
sudo service apache2 restart

Note : you can change /path/to/root/directory to anything you want, so not necessarily you must expose your complete localhost root dir.

13

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like