9

I've got a web server that isn't quite ready for general availability but I'd still like to test some things remotely. Can I leverage an SSH tunnel to connect to the server and then use the tunnel to route to the web service that is operating on the same server? If so how?

I realize that implementing firewall exceptions would be easier but that isn't an option at this time.

Sorry if this is confusing. I agree that it's a unique scenario.

CentOS 5.x

0

2 Answers 2

8

I know cherokee management works this way, so let's say you have bound your webserver to your localhost on port 8080

ssh -L 8080:localhost:8080 your_servers_ip

After that you can access the remote interface through http://localhost:8080 and every request will be forwarded to the remote IP running your webserver.

1
  • Thanks. On a side note, I also needed to modify my hosts file to leverage the address (as expected).
    – Mike B
    Jan 17, 2012 at 19:05
4

What Lucas said, where "localhost" can also be any reachable IP address from the SSH host.

Note that if you're using name virtual hosts, you will also need to do a /etc/hosts hack, so that you append something to the existing 127.0.0.1 line, something like:

127.0.0.1   localhost  secretwebserver.example.com

Your browser can then use http://secretwebserver.example.com:8080.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .