Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

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

You must log in to answer this question.

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