1

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.

2

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 http://externalIp you should get your default apache page (same as http://localhost)
  • 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.

  • I am aware of how to set a virtual host, but how do I put it to "listen" for shredalert.homelinux.com? I am not sure if my port is open or not. When I type in netstat -ntlp | grep LISTEN I get the following: tcp6 0 0 :::80 :::* LISTEN 6968/apache2 – shredalert Aug 1 '15 at 13:22
  • I reinstalled apache2 to try and configure it from a fresh start. Could you please supply instructions about how I should configure the apache2.conf file and the 000-default.config file in the /sites-enabled directory for my DNS host server shredalert.homelinux.com please? I can't seem to find any tutorials on how to configure apache v2.4 on the internet. All I keep finding are tutorials for how to configure v2.2, and the file structure is quite different. – shredalert Aug 1 '15 at 14:09
  • I have made a directory called /srv/shredalert.homelinux.com and put that as the DocumentRoot. I followed the steps that you have showed me. I made an html file called index.html in my root directory for the site. After following your steps and setting up a virtual host, it still logs me into my router instead of loading up my html document. No idea why this is happening. – shredalert Aug 2 '15 at 12:20
  • even if the apache config is wrong, it should not get the router page, are you sure you configured the router to forward port 80 to your machine? if so, since it's not working, maybe you have to reboot to apply changes. – bistoco Aug 2 '15 at 13:30
  • I have realised that I forgot to set up a static IP for my DynDNS. Now that I have set up a static IP 192.168.1.30 and forwarded port 80 on my router, it no longer tries to log me into my router. However, I have run into a new problem. When I try to load up my website, it says "This web page is not available." – shredalert Aug 2 '15 at 14:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.