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?

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.


You can set up an I2P tunnel.

If you only need TCP, you can set up a Tor hidden service.

If you only need to host static web pages, you can set up a ZeroNet site.

They all require no port forwarding.


After checking all these answers and linked how-to's I figured they all involve elaborate setups with big programs (that are partially made for other purposes) and config files and stuff so I decided to write my own solution.


It's a 250 line python script, which you can run directly from the git checkout.

Example: You have a HTTP server listening on your local machine on port 80. You want to make it available on your cloud server/VPS/etc's public IP on port 7000. We use port 8000 on the cloud server for the control channel.

use like


natsrv.py --mode server --secret s3cretP4ss --public --admin


natsrv.py --mode client --secret s3cretP4ss --local localhost:80 --admin example.com:8000

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"


  1. Check out portforward.com. They have detailed directions for this kind of thing, the basic idea is that you need to set the router 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.


Try to hosting your static website on IPFS

or dynamic website on I2P

  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.


1.) You need to port forward Port 80 to your internal ip address on Port 80

2.) Possibly. If you have a static ip from your ISP, you're all set with that strategy. If you don't have a static ip, you will probably need to make use of Dynamic Dns, which is where you run a piece of software on the server, and it continually updates the IP address of your domain name, which is usually something they assign. However, you can setup a CNAME record on your domain pointing to the one from the dynamic dns provider.

3.) I personally wouldn't say it's common, but it isn't uncommon either.


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

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.