Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

CentOS 5.x

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.

-M

share|improve this question
add comment

2 Answers

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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.