Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have installed a local web server for an web application for a customer. Their server is behind NAT and uses proxy for access internet.

Is there a way to access the web application remotely from my computer?

share|improve this question
up vote 2 down vote accepted

You will need to either create a port forwarding on the NAT router, but beware because then its open to the whole internet, or you need to have something connecting out to allow you in.

For example one thing what i like to do is to submit the following command behind a NAT.

ssh -R 10022: me@myserver.com

This command connects to myserver.com and opens port 10022 there. Then everything that connects to it's port 10022 will be tunneled to the source hosts Later I connect to myserver.com from anywhere, and on myserver.com I submit this:

ssh -p 10022

Like this I can get behind the NAT.

You could also do the same by directly forwarding to the webserver, like this:

ssh -R 10080:<private webserver ip>:80 me@myserver.com

Now, on myserver.com, you could browse to and would get to the webserver which is behind the NAT.

Both solutions, port forwarding or SSH are working, but SSH is much more safe because you don't need to expose your private webserver to the internet.

share|improve this answer
Sometimes I did have the issue that my SSH connections were timing out, so I couldn't connect behind the NAT anymore. To prevent that they time out, I also often submit this inside: while [ 1 ]; do echo "1"; sleep 60; done simply to make them have a little traffic – mauro.stettler Feb 18 '13 at 11:03
alternatively you can stick ServerAliveInterval 60 in your SSH config (~/.ssh/config) and it'll do that for you. – Oli Feb 18 '13 at 12:46
Nice one, thanks! – mauro.stettler Feb 18 '13 at 12:48

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.