How To Host a Public Website on Your Home Raspberry Pi

How To Host a Public Website on Your Home Raspberry Pi
(Image credit: Tom's Hardware)
5

From time to time, I like to let the internet control things in my home. Sometimes it’s letting a live stream turn on and off a light and  others it's driving a RC car around my living room. When building these projects, I normally use a Raspberry Pi to listen for web traffic and perform an event when someone visits the site.

I could give people my IP address and port forward my router to my Raspberry Pi, but I’d rather keep my IP private and my network as secure as possible. We can get the best of both worlds with a SSH tunnel, nginx, and a virtual machine in the cloud. All this creates a reverse proxy, where visitors hit a public IP address that’s not your home network’s and get directed to the Pi that’s on your LAN.

Latest Videos FromTom's Hardware
Ryder Damen
Freelance Writer

Ryder Damer is a Freelance Writer for Tom's Hardware US covering Raspberry Pi projects and tutorials.

  • hqmhqm
    Another easy way to do this is to use the ngrok service. They provide an ssh tunnel to an IP address of your choice, with a public facing TCP port you can use for HTTP

    see ngrok.io for instructions
    Reply
  • JOSHSKORN
    Neat, but I just saw Hostinger for only $2.59/month, and you don't even have to pay for electricity. I get it though, you could have total control.
    Reply
  • DotNetMaster777
    This is good tutorial what we can do with Raspberry !!!
    Reply
  • blando
    How would you use this to host wordpress?
    Reply
  • Eon046
    I've done it, it works, thank you very much.

    But I have a problem though;

    I'm starting gnix with "make connect", using PuTTY from another computer (as I have no peripheral plugged into my Pi).

    Should I close Putty or turn my PC off, it will also terminate the Gnix process, and the reverse-proxy stops.

    I have been told to use
    make connect &as it was supposedly putting the command "in the background", but it doesn't work still. Reverse proxy will stop if I close Putty.

    How could I work around this?
    Reply