Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 7 down vote accepted

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.

share|improve this answer
Thanks. On a side note, I also needed to modify my hosts file to leverage the address (as expected). – Mike B Jan 17 '12 at 19:05

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 line, something like:   localhost

Your browser can then use

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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