I have a program in var/html/ and when I connect to it locally I can see it. I wondered how can I connect to it from the internet like a website. I already looked on google but did not find anything. I wondered also how can I connect to it with a website for free.

  • 1
    what does connect to it mean? ....... what does this mean? connect to it with a website for free
    – jsotola
    Commented Jun 9, 2019 at 22:03

1 Answer 1


RFC 1918 ("local") addresses such as 192.168.1.x are non-routable across the Internet, so you'd need to configure a destination NAT ("DNAT") in the router in front of your Pi to forward traffic to it.

How this is achieved depends on how your router's web or CLI interface is organized. However, the operation is the same:

A) Set your DNS Record to point to the public IP of your router in front of the Pi hosting the webservice. Now traffic for the webservice on the Pi will hit your router from the outside world.

B) Next. configure a DNAT rule in the router to forward this traffic from the outside world to the internal (non world-routable) IP & port of the Pi running the webservice.

Now the world can reach the Pi from outside although the Pi's listening on a local non world routable IP such as 192.168.1.X.

Again, how you configure this depends on the model of router, but conceptually, this should be enough to get you started. I guess you could google the term "DNAT" for your router model for more specific guidance on how you configure the DNATing. HTH-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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