Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My desktop computer at work has apache running serving my webpage locally for dev purposes. I can access this no problem from work. What I want to do is VPN in to my company and SSH into my desktop and be able to access the locally hosted web page.

I can already VPN and SSH into my desktop, I just don't know how to serve the locally (from work) hosted web page to the out side.

So I guess I want my remote location to act as if it's my desktop.

Hope it's clear.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The easiest way to do this would be with port forwarding.

So first you have established your VPN so you can ssh to the desktop. Instead of your usual ssh command, do the following:

 ssh -L80:localhost:80 user@desktop 

Then from the machine you are running the VPN client on, you can access http://localhost to get to your remote webserver.

The above assumes:

  1. You aren't already running a web server on the machine you VPN from
  2. That apache is listening on port 80 as standard.

The way this works is the -L80:localhost:80 is saying, "Open port 80 on the machine I am sshing from, and any traffic that arrives on this port 80 should be transported across the ssh session, and sent to localhost:80 at the other end."

share|improve this answer

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.