Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My PC is behind a NAT router that has a public IP address. If I want to host a website then I believe I need a domain name which I can purchase from some site which would pledge to resolve all DNS requests for that domain name and send the IP address of my NAT router (assuming I do not want to host my domain name on their servers). Now I want to host a web server on my computer.

  1. What changes should be done to the NAT router's configuration to forward all HTTP requests for example.com to my PC in the internal network.
  2. Is the above strategy correct?
  3. Is it commonly used?
share|improve this question
add comment

5 Answers

up vote 3 down vote accepted

It is feasible to host a server behind NAT as you describe.
Look at this Ubuntu help page on ServersBehindNAT for basics.

Some more references,

  1. Hosting Apache server behind a NAT
  2. Setting up a server behind a NAT
    this uses a NAT Buffalo AirStation series router and Linksys router examples
  3. Windows XP Internet Connection Sharing method. if you have a Windows machine doing NAT
  4. [If you are using XP, you may also use IIS 6 5 (1 virtual host support) by going to Control Panel > Add and Remove Programs > Add Windows Component > Internet Information Services.

This is assuming you know how to host a web server and need ideas on NAT.

share|improve this answer
add comment
  1. Check out portforward.com. They have detailed directions for this kind of thing, the basic idea is that you need to set it up to forward TCP requests on port 80 to your computer's IP address. This brings up another thing: you will need to set your computer to have a static IP. If you have a DHCP server running on your router (which is the case in 97% of cases), make sure to assign one far above or below it. A google for "static LAN IP address" will probably bring up instructions on how to set this up on various OSes.
  2. It will work provided that your ISP is not blocking incoming connections on port 80; some do this for security reasons.
  3. Maybe. It's what I'm doing right now with ftp, http, ssh, vnc, xmpp, and a few other things...

You also need to run a web server on your computer. Just get Apache, it runs on almost anything and is what most sites use.

share|improve this answer
add comment

Another alternative might be something like homelinux, where your dynamic IP address can be mapped to a statix .homelinux. URL

There are also other choices other than "homelinux"

http://www.dyndns.com/

share|improve this answer
add comment
  1. port-forward tcp traffic to your router on port 80 to your pc onto port_whatever_you_are_running_your_webserver

  2. you do not need a domain name to allow others to access your webserver, the public ip is sufficient. a domainname to your public ip is just more convinient. otherwise your plan looks ok.

  3. your router is just "a firewall" between the public and your server. such setup is pretty common.

share|improve this answer
add comment

Your strategy pretty commonly used and if you bought a public IP, then your pretty much good to go.

You should get XAMPP. XAMMP pre-configured and Apache will use port 80 by default. Make sure no other process is running on port 80 or else Apache won't run. Generally Skype (if you use skype that is) plays spoilt sport and hogs port 80 you need to disable it from your connections settings.

It contains Apache, PHP and Mysql it will take care of all your needs. Just don't forget to secure it well.

Just bear in mind that XAMPP is not a production software but it should serve your needs of hosting a personal website/blog.

One more thing, if you want this website to be up 24/7 then you would have to keep your computer on pretty much 24/7.

If you need a free domain you can get a co.cc for personal use, and they renew it every year

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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