← Back to context

Comment by Jenda_

3 years ago

You can directly expose the port to the internet, not only localhost, with ssh:

- put "GatewayPorts clientspecified" into /etc/ssh/sshd_config, restart sshd

- ssh -R 0.0.0.0:8000:localhost:80 (the first parameter is the address where the tunnel should listen -- you can also pass something like 192.168.0.123 and expose it only to LAN etc.)

It's then reachable on your_vps:8000.

If you need it on the "correct" port and you are already running some other webserver (so you need to share that port), you need to set up a reverse proxy based on hostname or URL. I personally use haproxy, but for example nginx can do it too.