How can I make a website hosted on my personal server available for people to visit?

Sergii Iermolenko April 14, 2012
Pinterest Stumbleupon Whatsapp

Situation: I have Apache2 server with Linux Ubuntu OS 11.10.
Then I install a PhP5, MyAdmin, DNS server, LAMP server, MY SQL server.

This is what I have done:
– check localhost 127.0.0.1 and it works!
– edit index.html default webpage located in /var/www
– change my IP address to static
– restart /etc/init.d/apache2 restart {OK}
– bought a domain name
– turnes off Firewall on my router

Now I need Your HELP!

Please how and what needs to be done that other people around the world can type my domain name and connect to my server and default web page index.html located in /var/www? I do not care about security. I changed permission on /var/www/to 777 for the moment because I want to host my simple website or webpage only on my local server.

THANK YOU this is my first server and I guess YOU got the point.

My 3 questions are: How and what I need to do to connect to my server
from internet from any other PC.

Ads by Google

  1. RAHUL
    September 6, 2012 at 4:20 pm

    HOST THE WEBSITE ON YOUR PERSONAL WEBSERVER.....
    ----------------------------------------------------------------------
    1. CONFIGURE YOUR BSNL BROADBAND ROUTER OR ANY OTHER BROADBAND ROUTER BY DOING PORT FORWARDING IN THIS YOU FIND DMZ OPTION....THIS OPTION ALLOW YOU TO USE ON ANY PARTICULAR PC ON WHICH YOU WANT TO HOST YOUR WEBSITE BY ASSIGING IP ADDRESS OF THAT PC

    2.NOW,CONFIGURE YOUR WEBSERVER WETHER IT IS IIS OR APACHE TOMCAT....

    NOTE :- CHECK YOUR WEBSITE FROM ANY OTHER PC WHICH IS NOT THE PART OF THIS ROUTER

    DUE TO NOT HAVING STATIC IP, THE IP ADDRES IS CHANGE AFTER EVERY CONNECTION SO CHECK UR IP ADDRESS BEFORE OPEN THE WEBSITE BY USING IPCONFIG COMMAND IN MSDOS

  2. Patrick Jackson
    April 18, 2012 at 12:04 pm

    There is also a dead simple way:

    If you have or don't have a static IP, you can use services as DynDNS or FreeDNS (FreeDNS assumes that you have registered a domain, DynDNS has an option to provide a subdomain.). Both the services have apps for computer if you have a dynamic IP so that the website updates itself if your IP changes. But there can come some issues if your router does not forward your IP to the website.

    Good Luck!

    • sergii iermolenko
      April 18, 2012 at 12:17 pm

      sudo  nano/etc/network/interfaces
      auto eth0
      iface eth0 inet static
      address 192.168.2.150
      netmask 255.255.255.0
      network 192.168.2.0
      broadcast 192.168.2.255
      gateway 192.168.2.1
      ---------------------------------------
      and then I type ifconfig to check IP .Yes my IP now is static ,My question  is do I need to change my internal IP to external IP  like 345.231.567.876. (fake ip) 

      • Bruce Epper
        April 22, 2012 at 12:39 pm

        I am assuming you have a broadband connection of some sort (cable/dsl) in which case your modem's external interface will have your external IP address.  This is why you need to use port forwarding to get traffic destined for port 80 to go to your webserver.  What you are seeing as the 'gateway' is the internal interface of your router.  I've attached a basic network diagram that probably reflects your situation based on the IP configuration you listed.

        The solid arrowheads indicate traffic direction to/from devices.

        Your modem gets its external address from your ISP and arbitrarily takes 192.168.1.1 as the address for it's internal interface.  Your router gets its external address via the DHCP server running on your modem which will normally assign it an address of 192.168.1.2.  This is a mini-network between the 2 devices and it is shared with no other devices.  Your router then takes the address 192.168.2.1 for its internal interface.  All other devices you attach to your router, wireless or wired, will then get addresses on the same network subnet (192.168.2.xxx where xxx will range from 2 to 254).

        There should be a firewall enabled either on your modem or your router but you probably don't want it enabled on both devices.  Most commonly, the modem's firewall will be off and all of your firewall and routing configuration is handled on one device making it easier to manage.  As illustrated in the diagram, if you disable both firewalls, not only would your server be unprotected, but so is the laptop.

        With the modem's firewall turned off, all internet traffic that is passed to it will be automatically passed on to the firewall/router.  This is where you need to set up your port forwarding.  The details of how to accomplish that vary depending on the make and model of your router.  You will need to check your documentation for your router or respond here with that information if you need help setting that up.  The basics for port forwarding here is that any traffic that arrives on port 80 (http), you want the router to forward that traffic to 192,168.2.150 (the static address of your server).

        As long as you have your DNS records taken care of (described by James) or the alternatives provided by Patrick, you should be able to use a computer on the Internet to hit your website.

        If you think your firewall is the culprit making your website inaccessible, your router may allow you to put it in the DMZ which will effectively put your server outside of the firewall.

        • sergii iermolenko
          April 22, 2012 at 12:47 pm

          THANK YOU

  3. sergii iermolenko
    April 17, 2012 at 7:26 am

    . But I'm here to get professional help. I'm learning on the go .I have nothing to hide on my server.But thanks to  Bruce Epper I chmod 755 /var/www.I have no paranoia about security.I can not organize the work of my server.I will open all ports if necessary.I need instractions like cd ...go to directory open this type that
    Samething like 1. Create ANAME record in your domain host to point to your home internet IP2. Create a routing rule to send traffic on port 80 to your linux machines internal IP.Not working for me becouse I don't know how .EASY WHEN YOU KNOW HOW.PLEASE TELL ME HOW.All I need is simple instractions to follow.THANK YOU .

  4. Bruce Epper
    April 16, 2012 at 8:17 am

    I must also sarcastically say "Congratulations!  You have also set yourself up to be hacked in under 30 seconds!"

    Changing of permissions of /var/www to 777 allows anyone who knows your external IP address or domain name to read, write, and execute ANYTHING in your website's home directory and if you did a recursive chmod for this, every directory under your website's home directory is just as exposed.  This means I could upload a malicious script or program to your server and at a minimum, run it with the same permissions as your apache server daemon.  This could be something as simple as changing anything on your website and possibly taking advantage of other paths to take over your entire computer.  The owner should be the only entity with write permissions; group and world should not be able to write to ANY of those folders.  In other words, the permissions on these folders should be 755.

    Running bind (DNS server) on this machine is unnecessary and is just exposing another potential attack surface. You want to keep all running services to a minimum especially on servers.

    Another step that helps out the hacker is disabling your firewall on the router.  If this server is not the only device on your network, you have opened the door to ALL devices on the network.

    The steps James gives are what you need to do to get your DNS records created/updated and routed to the right machine.  His comment about the irrelevance of the static IP on your server is not entirely correct though.  You don't want this one moving around either otherwise you would need to update your forwarding rule on the router every time it changes, so it is best to be static as well (or permanenty assigned based on MAC address in DHCP).

    • James Bruce
      April 16, 2012 at 11:23 am

      Good point. 

      In fairness, he did state he doesnt care about security though. It's possible he's setting up a honeypot of sorts…?

      • sergii iermolenko
        April 16, 2012 at 1:19 pm

        Speculation is good . But I'm here to get professional help. I'm learning on the go .I have nothing to hide on my server.But thanks to  Bruce Epper I chmod 755 /var/www.I have no paranoia about security.I can not organize the work of my server.I will open all ports if necessary.I need instractions like 
        cd ...
        go to directory 
        open this 
        type that

        Samething like 1. Create ANAME record in your domain host to point to your home internet IP
        2. Create a routing rule to send traffic on port 80 to your linux machines internal IP.Not working for me becouse I don't know how .EASY WHEN YOU KNOW HOW.PLEASE TELL ME HOW.All I need is simple instractions to follow.THANK YOU .

  5. ha14
    April 15, 2012 at 12:18 pm

    simple dns plus?
    http://www.simpledns.com/

    Connect to a Server via Remote Desktop
    http://www.hosting.com/support/dedicated/general/rdesk

    ubuntu
    http://ubuntuforums.org/showthread.php?t=899871
    ran:
    iptables -I INPUT -p tcp --dport 80 -j ACCEPT

    Causes of Access-Denied Errors
    http://dev.mysql.com/doc/refman/5.5/en/access-denied.html

    openssh
    http://www.youtube.com/watch?v=hdvvEGShwts

  6. James Bruce
    April 15, 2012 at 10:17 am

    Sounds like you've just missed the step of changing your domain name servers to point toward your home IP. 

    However, the static IP you set on your computer is not relevant. You need your INTERNET to have a static IP, and then your router needs to forward port 80 to your linux server. 

    So. 

    1. Create ANAME record in your domain host to point to your home internet IP
    2. Create a routing rule to send traffic on port 80 to your linux machines internal IP. 

Ads by Google