I am tunneling Firefox through SSH to a remote server using:

ssh -D 9999 -C usr@remotehost.com

This binds 9999 port on localhost. I set this up in Firefox proxy settings using Socks5. It works perfect. But at same time when I run localhost/myPHPProject, it says 404 not found. Because my localhost IPs (, etc) are all bound to port 9999 SSH tunnel.

Here's my /etc/hosts   localhost   wplms   x8p-lin-pc   localproxy

What I want to do is use localproxy as SSH tunneled proxy for Firefox. And localhost, wplms for my LAMP projects. How is this possible?


You can use the -D option bound to a single local IP like so:

ssh -D localproxy:9999 -C usr@remotehost.com

The harder bit is probably getting firefox to distinguish which connections to send to localproxy and which ones to handle locally. It might be easier to use a local proxy (squid, varnish, nginx or whatever) to do the forwarding, so you get a more flexible configuration language.

  • It worked. Another thing I did is set SOCKS host: localproxy:9999 and No proxy for: localhost, wplms, ... – arxoft Oct 18 '14 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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