Making websites visible to outside networks with Ubuntu Server 12.04

6,991

Almost completely unrelated to Ubuntu but there you go...

  • Forward port 80 to your Ubuntu's internal IP, using your router and this guide.

  • Tell Ubuntu to unblock port 80 (might not be needed):

    sudo ufw allow tcp/80
    

By this point people outside your network should be able to put your IP in their browser and see the site. This won't work internally due to routers' routing restrictions so don't consider that a fault. Test with something outside the network.

For bonus points (and if your legal IP is dynamic):

  • Use a service like DynDNS to point a domain name at your IP

  • CNAME a real domain onto your DynDNS name with a short TTL.

  • Make sure the Apache config expects these domains (or you're using a wildcard/default host)

  • Set your /etc/hosts to shortcut the DNS so it looks locally rather than your legal IP:

    127.0.0.1    mydomain.com
    

If you have a truly static IP assigned to you by your ISP (some residential ISPs still do this), you can just point your domain at it with a long TTL.

Share:
6,991

Related videos on Youtube

Daniel Skrobowski
Author by

Daniel Skrobowski

Updated on September 18, 2022

Comments

  • Daniel Skrobowski
    Daniel Skrobowski over 1 year

    I am a new Ubuntu Server user, and I need some assistance in setting it up.

    I am using Ubuntu Server 12.04 64-bit.

    This is my main question: How can I set up Ubuntu Server to host a website that is visible from networks besides my own?

    I have seen and read multiple tutorials on how to set up Ubuntu Server, but all of them show you how to set it up to host websites on a LAN. In the setup processes I have seen, only the standard assigned IP addresses such as 192.168.0.180...have been used.... These processes would work for hosting on a LAN...but, if I go outside of my LAN, the hosted website would probably not be seen by typing in the IP addresses of 192.168.0.180:xxxx....

    The computer that will run the server is attached to my home network's router.

    How do I configure Ubuntu Server to make the websites that it hosts visible from other outside networks?

    If somebody could clue me in on what I'm missing or direct me to a good tutorial on this, I would be very grateful.

    Any advice is greatly appreciated.