0

I'm a complete noob at running my own server, and I want to install 3 different sites to be served from my Mythbuntu 14.04 system at home. What I want to do is not for actual public access though, but just me and maybe a small circle of other people. However, I want the sites to be publicly reachable in the sense that I can access them from any place outside my home network. However, I don't want to rent a domain for them, but access them just by the IP addresses.

My question is: how about public IP addresses? Do I need to have as many as the number of sites I want to host? I have a normal home DSL internet connection, and I think my ISP may only be handing me a dynamic IP address - but I still have to verify that, it may also be static. In short, is it possible to host like three sites, accessible from outside, on the same box, over this infrastructure, or would I need to make arrangements with my ISP for a different setup?

EDIT: Thanks for your answers, I'm not sure though I got it all figured out:

It seems that If I have a static IP, I don't need the DynDNS service, correct? It seems that I actually might, but I sent e-mail to my ISP to confirm (EDIT: no, it's dynamic).

Checking my router's control panel, I can't find a proper interface for port management. This router actually belongs to the ISP, it's a Technicolor Gateway TG788A1vn.

It has a panel for managing firewall settings with just three preset security levels, and basically that's it for managing the firewall!

firewall settings

In addition, I can "assign" applications,

applications assignment. "hermann" in this image is my server box

I suppose the router manages the respective ports, but I'm not sure if "assigning" the https server means it gets to communicate through port 80. Would you think that's what this panel does?

About the domain name vs. IP-only, I'm not actually opposed to using a domain (although IP-only might have a small security benefit?), I just don't want the extra cost. I wasn't aware there are free domains available, so that's good to know! :-)

2
  • 1
    You need dns service to convert site domain into IP address and reach your server. MartyFried suggests dynDNS in case you have a dynamic IP assigned every time you restart your router, Tim suggests to get static IP from your ISP and freenom.com to register domain and configure dns resolution. So, yes, static IP doesn't require client application that upgrade DynDNS about IP changes.
    – Lety
    Sep 5, 2014 at 22:14
  • I would assume that the presets they provide use the standard ports, like port 80 for HTTP, etc. If you want to use a different port, you'd probably just need to do the manual configuration. All that should ever be required is the port and the computer that handles that port. As for static vs dynamic, static is never the default, but may be available for an extra cost. Sep 8, 2014 at 2:26

4 Answers 4

2

I would advise the following:

  1. Get a static IP address (honestly, so much easier). I assume (from now on) that you have opened up port 80.

  2. Register a TLD (top level domain) - free ones are available, such as freenom.com

    1. Click Register a New Domain enter image description here

    2. Chose the domain you want, click search multiple TLDs and then select the top row. Click check availability. enter image description here

    3. Select the one you want, click the amount of time, then order now. enter image description here

    4. Complete the fields (100% free) enter image description here

    5. You will be sent back to the home page. Go to your domains... enter image description here

    6. Click manage domain. enter image description here

    7. Click Management Tools and then URL Forwarding. Forward it to a random website (like http://google.com) enter image description hereenter image description here

    That's registered!

  3. Now for the DNS

    Sign up to freedns.afraid.org, and add your domain. Steps how to follow:

    1. Sign up (free), then Click "domains", at the side

    2. Click add domain enter image description here

    3. Enter the domain, and see the highlighted section. We have to go back to freenom for that. enter image description here

    4. Go to manage domains again, and select manage this domain. enter image description here enter image description here

    5. Select Manage Freenom DNS enter image description here

    6. Select Before using this service, please click here to activate Freenom Default Name Servers.. enter image description here

    7. Finally, enter into the fields the following:

      enter image description here

      NS1.AFRAID.ORG
      NS2.AFRAID.ORG
      NS3.AFRAID.ORG
      NS4.AFRAID.ORG

    8. Go back to Free-DNS and click submit enter image description here

    9. Ignore the warning, and just click subdomains. enter image description here

    10. Click add enter image description here

    11. Enter the relevant details, and click save. Repeat for the other subdomains. enter image description here

    12. Enter your domain and click trace. This can speed up the time it takes to start working. enter image description here

    13. Wait for the changes to propagate across the internet - for me it was about 24 hours. I watched funny cat videos: enter image description here

  4. Now we have to set up apache.

    1. Make 3 folders in the root (/var/www/html) and give them sensible names. In each of those you need an index.html file (or whatever you do with your gaming set up, just separate it into 3).

    2. Use this command to open the file in gedit:

      sudo gedit /etc/apache2/sites-enabled/000-default.conf
      
    3. Add in the following lines, at the end. I put it above the # vim: syntax=apache ts=4 sw=4 sts=4 sr noet line, but that makes no difference from what I know.

      <VirtualHost *:80>
          DocumentRoot "/var/www/html/game1"   #Edit this line to have the correct folder name
          ServerName game1.mynametestdomain.tk #Edit this line to have the correct subdomain name
      </VirtualHost>
      
      <VirtualHost *:80>
          DocumentRoot "/var/www/html/game2"   #Edit this line to have the correct folder name
          ServerName game2.mynametestdomain.tk #Edit this line to have the correct subdomain name
      </VirtualHost>
      
      <VirtualHost *:80>
          DocumentRoot "/var/www/html/game3"   #Edit this line to have the correct folder name
          ServerName game3.mynametestdomain.tk #Edit this line to have the correct subdomain name
      </VirtualHost>
      
    4. Restart apache with

      sudo service apache2 restart
      

Make sure everything is working (as I said, it may take 24 hours+ to set everything up.

  1. Finally, set up an index.html in the root that has the links to the other pages - just in case they visit your ip address.
10
  • I must say, your idea of "much easier" is quite different than my own. But the main problem with static ip addresses is that they can be quite a bit more expensive every month, and may not even be available without a commercial account. Sep 4, 2014 at 16:46
  • I paid $7 once for mine, no more charges. Maybe different ISPs? I personally don't like having to change the ip (or have a script running that does).
    – Tim
    Sep 4, 2014 at 21:49
  • 1
    Well, I've been using dynDNS for years, never had a problem; it always works. To me, it's much easier, and personally, I prefer the IP to change. It actually can add a level of security. Sep 4, 2014 at 22:34
  • 1
    Yes, it can, and I personally have a changing one on one of my servers - it is not much harder. However I thought it would be better for the OP...
    – Tim
    Sep 5, 2014 at 6:55
  • 1
    Port 443 is default port for https protocol, http use port 80 as default instead. You can use one port if you define "name based virtual host", this means that virtual host are distinct by domain name (in this case you need DNS). If you want use SSL there is problem with single IP, because each ssl-certificate need to be associated to a specific IP address unless you use self-signed certificate.
    – Lety
    Sep 7, 2014 at 18:54
2

You can definitely do it, and it's not really hard at all. I used to do web site programming for a few small businesses part time, and I had several sites on my home server for demonstrating works in progress. I used (and still use) dynDNS, for which I pay $25/year. As someone else mentioned, there are free services, but they all require certain hoops to jump through. I personally feel that the cost I pay is not enough to worry about. When I signed up, they had free services, but I don't know if they still do.

The way DynDNS does it is you can register any number of names that you choose from their selection. For example, they have one called homelinux.net; you then can register a name like "Bennypr0fane.homelinux.net", and it will be routed to your current IP address, which you maintain by running an update client periodically (they have help on how to do that, and even supply a client for Ubuntu).

Then, you have a web server running, such as Apache, which has a virtual site running under that name. You can have other sites running under other names, or other servers running with other ports. I have my ebook library accessible via a Caibre server, plus websites. You will need to tell your router about each port that needs to be accessed.

2
  • I am having trouble setting up my router for a dynamic DNS service. It seems to have templates for some well-known providers, and one that says "custom". I found that afraid.org also offers dyndns service, and they don't require you to hand over all yr personal information down to size of underwear, so I signed up for an account, but something isn't working. If I created subdom.domain.com, that's what I need to enter in the "host" field of my router's DynDNS interface, while my username and password should be my account creds with afraid.org, right? Sep 7, 2014 at 23:40
  • 1
    I have never been able to use a router's dynamic DNS setup. I suspect that things change with the site's requirements, and break the router login or something. I don't know afraid.org at all, but what you said sounds right. They should have some example for the "host" field somewhere, though. Sep 8, 2014 at 2:23
2

Yes, certainly, be careful to open port on the public network, but if you want to do, you can do it.

You could use three different port on same public IP and access these site with:

    http://ip:port/

You should configure your router to forwards and nat to internal static IP where apache listen with three different virtual host

Obviously, public IP address changes each time you reboot your router, so, if ilarsona'answer or even better Marty Fried' answer meets your needs, then you should follow it.

1

I do not under any conditions recommend you go off of IP addresses alone. They are always changing.

This question has more to do with the configuration of your router rather than the actual configuration of Ubuntu. On your router, you need to make sure that port 80 is open. There is always risk in opening up a port to the outside internet... keep that in mind.

I also recommend you either invest or do a little searching for a dynamic dns update client. I had one with No-IP but I found that it was really annoying because you had to login every 30 days. Still, they gave me a more friendly hostname (like ilarsona.ddns.net).

In theory, for multiple websites, all you'd need to use (assuming you use No-IP) would be yournamehere.ddns.net/website.

--More Detail--

A dynamic DNS is not typically handed to you by your ISP. In fact, it's intended to get around your restrictions by your ISP. Static IP addresses are expensive, and what a dynamic DNS service does is uses the non-static ip address and creates a hostname out of it. It logs and changes the pointer back to your REAL IP address about every 30 minutes.

What happens with your router is that, it wants to protect you from the outside internet world, and it doesn't realise that you actually think it's getting in the way. Without a router configuration, using a public IP address alone would not work. Thus, you need to open up port 80 on your router for incoming traffic, preferably to your server alone, so that the server can do its job.

I've also found that browsers are often confused by

    http://124.466.98.90 

(or something like that) which is why

   http://yourname.ddns.net

would be way more helpful. The dynamic IP takes care of all the hard work for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .