Is it possible to host a web server from behind a NAT

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?

Solution 1:

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.

Solution 2:

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.