Page 1 of 1

Hosting a local server SSH tunnel via vps

Posted: 2018-11-30 04:20
by devind0
Hello. Bit of an odd scenario here. I have a business where I am co locating a server that I would like to set up as a web server. I am unable to host the web server directly off the business ip address, and would prefer not to expose the public ip of the shop to the world. I have a vps running debian, I was curious if i could set up some kind of configuration that would allow me to set up a ssh tunnel of sorts to send all traffic destined for the VPS to the shop via a ssh tunnel.

I figured this scenario would be ideal as all i would need to do is keep a ssh port open and I could keep everything else blocked behind a firewall.

Any infortation to help get it set up of better understand how to configure things to work in this manner would be appreciated.

Re: Hosting a local server SSH tunnel via vps

Posted: 2018-11-30 04:53
by dilberts_left_nut
Why not just run the website on your VPS?

Re: Hosting a local server SSH tunnel via vps

Posted: 2018-11-30 09:16
by reinob
devind0 wrote:Hello. Bit of an odd scenario here. I have a business where I am co locating a server that I would like to set up as a web server. I am unable to host the web server directly off the business ip address, and would prefer not to expose the public ip of the shop to the world. I have a vps running debian, I was curious if i could set up some kind of configuration that would allow me to set up a ssh tunnel of sorts to send all traffic destined for the VPS to the shop via a ssh tunnel.

I figured this scenario would be ideal as all i would need to do is keep a ssh port open and I could keep everything else blocked behind a firewall.

Any infortation to help get it set up of better understand how to configure things to work in this manner would be appreciated.
You want to use remote port forwarding (ssh -R). There are many examples you can find by searching (the manpage may be a bit dry but should always be your first hop).

Code: Select all

ssh -R 443:localhost:443 root@your.vps.ip
should forward port 443 of your vps to port 443 of your localhost (i.e. where you host your web site and run the above command).

Re: Hosting a local server SSH tunnel via vps

Posted: 2018-11-30 14:58
by pcalvert
devind0 wrote: am unable to host the web server directly off the business ip address, and would prefer not to expose the public ip of the shop to the world.
Cloudflare may be able to help you with that.

Phil